How to rename filenames
rename Dell Fujitsu *
rename "s/ *//g" *.mp3
rename 'y/A-Z/a-z/' *
rename "y/ /-/" *
shopt -s globstar
rename -n 's/special/regular/' **
Remove the -n switch when your tests are OK
file.1.png
file.2.png
…
file.10.png
…
file.1000.png
file.1001.png
…
How can I pad the number to 4 digits? It should end up like this:
file.0001.png
file.0002.png
…
file.0010.png
…
file.1000.png
file.1001.png
…
rename 's/(\d+)/sprintf"%04d",$1/ge' file.*.png
http://unix.stackexchange.com/questions/21425/padding-a-number-in-a-filename-to-a-fixed-length