pyRenamer: Bulk Renaming Made Easy

Renaming files in batches is a rare task. Probably, that is why, with the exception of Xfce’s Thunar, desktop file managers can only rename files one at a time. However, when I digitize music, I am dealing with ten or more files per albums, and I need a bulk renamer. Of course, I could use the rename command, and, using it four or fives a week, I would soon get to know the options I wanted. However, for such a repetitive task, a desktop tool is more convenient. It was with this need that I rediscovered pyRenamer for the second or third time. As I quickly remembered, it is by far the most versatile of all the alternatives.

As the name suggests, pyRenamer is written in Python, and offers most of the options of the rename command.  It comes with only brief online help embeeded in the interface, but, aside from a few obscure features, is easy enough to figure out by trial and error. By default, the interface consists of a directory manager on the top left, and a pane on the top right for the files in the currently selected directory. On the bottom left are the options for renaming, and on the bottom right the controls. Users can also choose to select  View | Show Options to add an option pane on the top right. The options include such useful functions, as automatically preserving file name extensions and showing a preview of the selected renaming options. The Options pane can also be used to enter regular expressions to limit the file names that are bout to be renamed.

Renaming is easy. By default, changes to the file names apply to every file in the current directory (which tells you how you want to arrange files), or to the individually selected files. Once the changes are set up, a preview is mandatory to help reduce the possibility of disaster (which is why automatically showing the preview saves effort). If the preview shows an error, you can Clear the proposed changes. However, o
nly when a preview exists can you actually rename. Note, however, that the interface is basic, and does not include a confirmation dialog. If you think better of the changes, you will need to fall back on Edit | Undo.

Renaming Options
The value of pyRename lies in its options. The lower left pane consists of six tabs, some of which have snippets of help on the tab, and others which have a popup dialog of available options. Several have a field for the original name marked with {X}, but you can ignore that field and concentrate on the field for the renamed pattern, which is usually built with the help of building blocks listed in the popup dialog:

-Patterns: Contrary to what you might expect, this tab is not for working with regular expressions. Instead, it is for adding a sequence of numbers or elements of the date to a collection of files. The numbers can be random if you choose.

– Substitutions: On this tab, you can add common modifications. For example, if you want to conveniently deal with files from a command line backup, you can replace spaces with hyphens or underscores. You might also enter characters to replace potentially troublesome characters like question marks. The other options on the tab include changing the case of file names, or accents.

– Insert/Delete: This tab is more limited than its name suggests.  From it, you can insert a prefix to the existing file names, or delete a range of character, counted from the start of the file names. For example, a range of 3-5 will delete the third, fourth, and fifth characters in each file name.

– Manual Rename: Unlike the other tabs, this one requires the selection of a single file. It’s the equivalent of changing the name in the Properties window of a file manager. It can be useful for cleaning up minor renaming mistakes.

– Images: Uses the meta-data of images, such as the date and time of the image to build the pattern of new file names.

– Music: Uses the meta-data of music files to build the pattern of new file names. For instance, since my digitized music is arranged with a top level directory for the musician or act, and a sub-directory of the album, the music files only have to be re-named using the pattern {track}-{title}.

You might need to use one or more tab to rename as you want. Personally, I start with the Music tab, then use the Substitutions tab. If there are several characters that I want to delete, I may run several replacements. You will probably have different habits.

On Borrowed Time
pyNamer has its limitations. I would like to use comma-separated lists of replacements to make all the substitutions in one pass instead of one at a time. I would also like pyRenamer to refresh the directory and file panes automatically, and to make use of regular expressions as well as building blocks.

However, I should probably be thankful for pyRename at all. Although it is included in most major distributions, the last commit on its GitHub page was five and a half years ago, so I assume that pyRenamer is orphaned. Conceivably, a time might come when it ceases to work. Meanwhile, what we have saves me at least an hour or two a week as I digitize my music.