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

1/4/2000 to 1/4/2025: Director

Mirth: recover space when mirthdb grows out of control