Saturday, January 07, 2012

Bulk Rename Files in Ubuntu / Linux

If you have a lot of files to be renamed, it will waste you time to rename files manually (for example, change file names from camera). If you want to change the capital or uppercase files name to lowercase, you can do the following command in your terminal in the current directory,
ls | while read upName; do loName=echo "${upName}" | tr '[:upper:]' '[:lower:]'; mv "$upName" "$loName"; done But, if you want to change file names, find and replace, or others, you can do the following command: for filename in */*240p*; do echo mv \"$filename\" \"\${filename//240p/}\"; done | /bin/bash
In that case, the command will remove "240p" in the directory and in its lower folder. For example the file with the name like week2-360p.mp4 will be renamed to be week2.mp4

Another way is to do bulk rename is by installing thunar (GUI-based),
sudo apt-get install thunar
And then use the bulk rename program from thunar as shown in the following screenshot. You can insert date / time, insert / overwrite, search and replace, numbering and also uppercase / lower case. Let's try!
 Thunar bulk rename in Ubuntu / Linux