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.

3 comments:

Anonymous said...
This comment has been removed by a blog administrator.
Anonymous said...

I just love your weblog! Very nice post! Still you can do many things to improve it.

Anonymous said...

Amiable fill someone in on and this enter helped me alot in my college assignement. Thanks you for your information.