Examples :
Change all jpg files of a directory /tmp/user into mp3 files
Quote:
rename 's/\.jpg$/\.mp3/' /tmp/user/*
|
Removing all blank space of all files of a directory /tmp/user
Quote:
rename "s/ *//g" /tmp/user/*
|
To convert all uppercase filenames to lowercase:
Quote:
$ rename 'y/A-Z/a-z/' /tmp/user/*
|
Suppose there are 55 files in the folder /usr/src/zz-folder/thumbnail_square as name1.txt name2.txt and so on and you want to change all into name1.jpg, name2.jpg and so on
Quote:
rename 's/\.txt/\.jpg/g' /usr/src/zz-folder/thumbnail_square/*
|
Suppose there are files a,b,c,d,e,f in /tmp/user and you want to add prefix .txt in the files
Quote:
rename "s/$/\.txt/g" /tmp/user/*
|