Rename Command Tips For Multiple Files
Join the DZone community and get the full member experience.
Join For Freeadd an extension to multiple files in different location:
$ EXT=`date "+%m%d%y.%H.%M"`
$ find . -type f -name "name" | xargs -i mv {} {}.$EXT
For example rename all *.bak file as *.txt, enter:
$ rename .bak .txt *.bak
Remove all blank space with rename command:
$ rename "s/ *//g" *.mp3
To remove .jpg file extension, you write command as follows:
$ rename 's/\.jpg$//' *.jpg
To convert all uppercase filenames to lowercase:
$ rename 'y/A-Z/a-z/' *
Command (computing)
Opinions expressed by DZone contributors are their own.
Comments