Rename many files at once aka bulk rename

Sell Your Photos And Videos Online

How to Sell Your Photos Online

Get Instant Access

Have you ever been out with your digital camera and then returned home to find yourself with lots of files with names like IMG_0159.jpg, IMG_0160.jpg, IMG_0161 .jpg, and so on? And have you then gone through one-by-one renaming them with something relevant? Well, there's no need to ever do that again because Ubuntu can come to the rescue!

There are a handful of ways of bulk renaming files at the command-line but many are quite involved and you'll need to remember a chain of commands. To save the effort, use Synaptic to install purrr (that's pu, followed by three "r"s!). This is a GUI application that allows simple bulk renaming. once installed, you'll find the program on the Applications ^ Accessories folder.

1. Start by clicking and dragging the files from a Nautilus window onto the Files section of Purrr. If you intend to bulk rename the files with sequentially increasing numbers, it's important to first sort them into the right order before dragging across—possibly the best way of doing this is to click View ^ View as List in Nautilus, and then click the Date Modified heading to sort by the time the files were created (this is ideal for digital photographs). Alternatively, you might click the Name heading if the filenames can be sorted alphanumerically. Then [Shi ft +click to highlight many files at once and drag them into the Purrr window.

2. In the Name template text field, you need to type the basic format of the new filenames. For example, if the pictures were all taken at Disneyland, you might type that. You'll see the effect on the new filenames as you type, although they won't actually be renamed until you hit the Rename button.

3. There are a handful of useful special inserts you can make into the filename. Typing [N] causes the original filename to be added to the renamed files, while [C] adds a sequential number count. [E] causes the file extension to appear (necessary if [N] isn't used).

Here's an example. The following, when typed into the Name template box, will cause all the files to be named Disneyland, followed by a sequentially increasing number, and then followed by the original file extension:

Try it to see what happens. The [C] (count) operator can be further configured. A single comma inserted after C, followed by a number, sets the start number for the count. For example, [C,400] will start the count at 400. See Figure 3.38, on the next page for an example from my test Pc. Two commas causes the count to skip numbers as it counts upward. For example, [C„4] will name the first file with 1, the second with 5, the third with 9, the fourth with 13, and so on. In other words, +4 each time.

File Help Name template: Files

File Help Name template: Files

Old name

New name



afr Disneyland 400.E



^ Disneyland 401,E



Disneyland 402,E



Disneyland 403,E



afc Disneyland 404,E



^ Disneyland 405,E



a^ Disneyland 406,E



^ Disneyland 407,E



^ Disneyland 408.E



^ Disneyland 409,E



Disneyland 410,E



^ Disneyland 411,E



nknPvlanH ill 7 F

Exclude files Qrtslp

Exclude files Qrtslp


Figure 3.38: Bulk renaming files using Purrr (see Tip 230, on page 270)

Three commas causes the count to be "padded" with zeros, and the number of zeros is specified by the number that follows. [C„,3] will cause the count to start at 001, then 002, then 003, and so on. When the count reaches double or triple figures, the padding zeroes will disappear (ie disneyland_009.jpg, disneyland_010.jpg ... dis-neyland_099.jpg, disneyland_100.jpg and so on).

4. Once you've typed your selection, hit the Rename button to carry-out the renaming.

Was this article helpful?

0 0
Digital Cameras For Beginners

Digital Cameras For Beginners

Although we usually tend to think of the digital camera as the best thing since sliced bread, there are both pros and cons with its use. Nothing is available on the market that does not have both a good and a bad side, but the key is to weigh the good against the bad in order to come up with the best of both worlds.

Get My Free Ebook

Post a comment