Welcome to the web's most helpful Online Free computer tips and tricks website. This site contains all Latest and Cool Computer tricks as well as some Internet Tricks, Registry tricks, Orkut tricks, Windows customize and Optimization tricks, Computer Tweaks. Solve your computer problems by browsing the website for related Computer solution. All tips work well in both Windows XP as well as windows vista or win 7 operating systems. Need some Computer Help? Then this website suites your must need. These windows and internet Hacks Tricks are safe and free from any Spy ware. Learn All Basic and Advanced computer tips and tricks and be a computer master. All the computer tips at Hack2011 are very interesting and are mainly meant for education purpose. Visit my new Computer Tips Blog and leave your comments and suggestions there. Enjoy your stay and read all the articles posted here.

Batch Rename Files In Linux With Thunar

At times it becomes necessary to rename a large number of files at once.  Maybe it’s because you just downloaded a batch of photos from your digital camera, or maybe you realized a lot of your MP3 files weren’t named correctly.
Regardless of what and why, it can be incredibly tedious to have to rename item after item, especially if you’re performing the same modifications to each file.  There are stand-alone batch renaming utilities available for Linux, but if you use Xfce (or simply don’t mind installing a second file manager on your System), Thunar – the default file manager in Xfce – has a fantastic batch renaming utility built-in.

Install Thunar and Thunar Bulk Rename

The first step is to install Thunar.  To do this, let’s open up a Terminal window.
Open The Terminal

Once we have the Terminal open, type in the following command:
sudo apt-get install thunar thunar-media-tags-plugin
This installs both the Thunar file manager and the tag plugin, which allows Thunar to edit tags and the bulk rename tool to rename files based on their tags.
Once the installation process is complete, you’ll find a Thunar File Manager entry in your Accessories menu.
Thunar Menu Entry
What we still need, however, is the Bulk Rename entry.  It was installed along with Thunar, but its launcher, for whatever reason, was hidden by default.  To make it visible, we now need to type the following into the Terminal:
sudo nano /usr/share/applications/Thunar-bulk-rename.desktop
The nano text editor will load this desktop file.  Scroll all the way to the very end until you see the following:
No Display True
That line is telling the menu system to hide this menu entry.  To make it visible, you can either delete the line entirely, or comment it out, by placing an asterisk in front of the line, like this:
No Display Commented Out
Now, hit Ctrl-X to quit nano.  You’ll be asked if you want to save the changes you’ve made:
Save Changes In Nano
Hit Y, and then Enter, when asked which name to save your file as.
File Name To Write
Note: Hitting Enter without giving the file a new name simply saves the changes in the original file.
Now when we return to the Accessories menu, you’ll notice a new menu entry.
Bulk Rename Menu Entry
This is what we want, so go ahead and open it.
Bulk Rename Window
You’ll see the four buttons in the toolbar, which from left to right are for adding new items to the file list, deleting selected items, clearing the entire list, and – on the far right – displaying info about Thunar Bulk Rename.

Renaming Files Using the Thunar Bulk Renamer

To add some files, first click the plus sign and select your files from the file picker, or simply drag them into the window.  Once the files have loaded, you’ll notice two columns.  The column on the left has the current name of the files, while the column on the right has the new name of the files, if anything would be changed.
Bulk Rename Uppercase Lowercase
In the above example, you can see that the Uppercase/Lowercase operation is in use.  If we continue and click the Rename Files button, all the file names would be converted to lowercase.  Also available (look at the pop-up menu), is an option to convert everything to Uppercase, and one to use Camelcase, which is where the first letter of every word is capitalized, and every other letter is lowercase.
Also, the pop-up menu that reads Name only allows us to control what is modified.  We can modify only the name of the file, only the suffix (.doc, .mp3, etc…), or both.  This is useful if you have a batch of files (let’s use music as an example), where some files have MP3 while others have Mp3 and still others have mp3; using the Thunar Bulk Rename tool, you can make them consistent.
In addition to adjusting the case of the file names, Thunar Bulk Rename offers us the ability to search and replace within the title, to insert text (or overwrite), to add numbering, insert the date and time, and to remove characters from the file name, starting at the beginning, the end, or “x” number of characters into the name.  It’s a very useful tool.
And, since we installed the thunar-media-tags-plugin, we have the ability to rename files based on the tags inside the file.  A good example of that is the following image:
Bulk Rename By Tag
Our original files were named using the tracknumber, then a space, then the name of the song, like this:
02 Goody Goody.mp3
However, we’ve modified the pattern, and without having to retype anything (since these files were already tagged correctly, something you can learn to do by reading this article), we simply had to type in a custom format, and now the file name includes the track number, artist, album and title, like this:
02 – Frank Sinatra – Live In Paris – Goody Goody.mp3
If we want, we could also have Thunar Bulk Rename convert any spaces to underscores, which would result in this file name:
02_-_Frank_Sinatra_-_Live_In_Paris_-_Goody_Goody.mp3
We can also adjust the case should we want it to be entirely lowercase.
And that’s pretty much it!  When you’re finished renaming your files, simply click the Rename Files button found in the bottom-right corner.
Rename Files
The process is nearly instant (as the only thing changing is the title), and in a second or two, all your files should be renamed.  Thunar Bulk Rename is an incredibly easy-to-use, wildly useful program, and one that should ease the workload for anyone with a lot of files to rename all at once.

No comments:

Post a Comment