Over a million developers have joined DZone.

Rename Command Tips For Multiple Files

·
add 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/' *
Topics:

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}