Sunday, April 22, 2012

How to rename multiple files in Ubuntu?

Using the rename command and Perl expression. In the terminal:

To rename all upper case file names with extension .JPG to lower case

Test first.
rename -n 'y/A-Z/a-z/' *.JPG

Execute and show the operation.
rename -v 'y/A-Z/a-z/' *.JPG

To remove all colon character out of of the file name:
rename -vn 's/[:]//g' *

To remove all non-alphanumeric characters:
rename -vn 's/[^A-Za-z0-9._]//g' *

For more inforation, type 'man rename'

No comments:

Post a Comment