Monday, December 11, 2006

Linux : renaming files with rename in a loop

Following command (a small shell script) changes file extensions of all files from .TXT to .txt in the working directory.

for file in `find . -type f -name "*.TXT"`; do rename .TXT .txt $file; done

The above works in bash. For use in other shells, you'll have to change the looping sytax.