Tuesday, March 6, 2012

Bulk File Rename

As usual there are command I use just often enough to forget them when the time cose. In our case we had a group of files that has the file extension in caps which was causing a problem with some 3rd party javascript so instead of modifying the .js files we change the extension to lower case (.JPG to .jpg).

for file in *.JPG ; do mv $file `echo $file | sed 's/\(.*\.\)JPG/\1jpg/'` ; done