Say you want to add a '.old' to every file in your current directory. At the end of each expression ($) a '.old' will be set:
rename 's/$/.old' *
Or you want to make the filenames lowercase:
rename 'tr/A-Z/a-z/' *
Or you want to remove all double characters:
rename 'tr/a-zA-Z//s' *
Or you have many JPEG files that look like "img0000154.jpg" but you want the first five zeros removed as you don't need them:
rename 's/img00000/img/' *.jpg
rename will accept any regex and any perl operator
No comments:
Post a Comment