One liner shell command to find and rename to lowercase all SHP, DBF, and SHX file extensions

One liner shell command to find and rename to lowercase all SHP, DBF, and SHX file extensions starting from current directory:

EXTENSIONS="SHP SHX DBF"
for E in $EXTENSIONS ; do export E; export e=`echo $E | tr '[:upper:]' '[:lower:]'`; for f in `find . -name "*.$E"` ; do mv $f `echo $f | sed "s/$E/$e/"`; done  ; done

Useful when you get your shapefiles over from Windows and mapserver won't cooperate.

Popular posts

Opengrep quickstart

Mirth: recover space when mirthdb grows out of control

From 0 to ZFS replication in 5m with syncoid