Off the Beat: Bruce Byfield's Blog
Almost always, command line tools are more efficient than desktop ones, especially for file management. Recently, however, I found myself needing to clean up the file names from six hundred ripped CDs, removing illegal characters, replacing spaces with hyphens, and half a dozen other minor adjustments. To my surprise, the most convenient tools for the task were on the desktop: The Thunar Bulk Rename utility, KRename, GPRename, and pyRenamer.
The trouble was, I needed more options that the mv command supports. Working on a Debian system, I could have used the rename command, if I remembered enough Perl to make it effective. And, of course, I could have written a BASH script or played around with sed. But all these would have taken time when I wanted instant gratification, so I turned to these desktop tools hoping for a quick fix.
As the name suggests, this utility is part of Xfce's file manager Thunar. Started with the option -B, it opens in a window in which much of the functionality is hidden in right-click menus or drop-down lists.
However, if you can overcome any initial panic caused by this simplicity, Thunar Bulk Rename's use rapidly becomes self-evident. In the top two-thirds of the window, you right-click to add files -- not directories.
Then, in the bottom third of the window, you can choose the format for the renamed files, adding a date and/or time, inserting or overwriting text, adding numbers, removing characters, searching and replacing characters, or switching between upper and lower case letters. You can then choose whether each change applies to the file name, and/or its extension, and the exact position at which each change can be made. As you set up each change, you can preview what you are doing in the list of files at the top of the window.
The result is a reasonably thorough set of options, but one that sometimes seems needlessly complicated. Why, for example, have the option to state the position from which characters will be removed? After all, chances are that if you want to remove a character in one place, you will want to remove it everywhere -- and, if not, a search and replace will do. And what is the point of a detailed set of options to denote date and time if they are not specified in the interface? Nor is there any option that I could see for creating copies of the chosen files in a new location, instead of overwriting the existing files. For reasons like these, I soon abandoned the Thunar Bulk Renamer.
By contrast, KRename organizes its window so that the steps are self-evident. All you need to do is follow the numbered tabs. In the first tab, you select the files. In the second, you decide whether to leave output in the current directory, copy or move them to another directory, or to create symbolic links in another directory, and whether you should overwrite the originals.
However, just as you are starting to feel confident, you hit the third tab, in which you have to choose the plugin to use. Some of these plugins are highly specific -- for instance, there is one exclusively for font names, and another for reading the metatags for audio and video files, and yet another for reading metatags for JPEG and TIFF format graphic files. For some, like Transliteration, there is no clear sign that you have selected them in the interface, or whether you need to add anything. Nor can you choose two plugins at once, although I would have thought using the Permissions plugin with any of the others would be a popular choice.
As if this mess was not confusing enough, on the fourth tab -- which you must click before the Finish button is available for use, regardless of whether you require it or not -- are more renaming options, centered on the file name. You can choose to work with the Simple Filename tab, and only add a prefix or suffix, or go to the Advanced Filename tab and create a template for future use, or make such changes as a numbering system that starts at a given point, or do a find and replace.
KRename has a lot to like, including sub-windows from which you can select building blocks for some of the more complicated options. But the third and fourth tab are frankly a mess, and although anyone with enough experience to be doing a bulk rename in the first place can probably navigate the mess, the question is why they should bother doing so. Unless you are prepared to be patient, Krename can be almost as arcane as the most complex command line tool you have seen.
GPRename's window is simpler than either Thunar Bulk Rename's or KRename's. The top is a basic file manager, with a directory tree and list of files, along with a few basic options. At the bottom are four tabs, each clearly named, with all the options on each tab visible at the same time.
One advantage of GPRename is that it allows you to select directories, instead of just files.
Unfortunately, it does not allow you to apply more than one change at at time. It also shows the Thunar Bulk Rename's obsession with character position on the Insert Delete tab, and descends into KRename's use of obscure building blocks to make Case Change more complicated than the average user expects. Still another disadvantage is that, while you can number files, you cannot change the order in which the numbering applies. These shortcomings more than offset the advantages of the simple interface.
I have not checked which came first, but GPRename and pyRenamer have almost identical interfaces. The main difference is in the organization of the tabs; pyRenamer has six to GPRename's four, and, although GPRename's are more clearly named, pyRenamer, like KRename, has options specific to certain types of files.
PyRenamer's tabs: Patterns (which can be used to change the types of characters used in file names); Substitutions (common changes, such as spaces to underscores or capitalization); the self-explanatory Insert/Delete; and Images and Music (for renaming these types of file using their metadata).
PyRenamer also makes extensive use of building blocks, but mercifully provides dialogs as a crib, and has the considerable advantage of allowing you to set up multiple renaming options in a single pass. You can also rename files one at a time, before applying all changes.
A particularly useful option in pyRename is Remove Accents, accessible with one click and helpful in creating files that BASH can use regardless of locales.
My sole complaint about pyRenamer is that you cannot set up multiple Replace patterns at the same time. However, since you can remain on the Substitutions tab and apply patterns one at a time, the inconvenience is not as great as it might have been. After working with the others, the simplicity and arrangement of pyRenamer makes it my tool of choice for renaming on the desktop.
Choosing a Renamer
The one drawback of this investigation is that, by the time I had chosen pyRenamer, I had taken more time than I would have done to remember basic scripting. Since I am unlikely to be digitalizing another six hundred music albumns soon (or ever again), what I found is of limited use to me.
Still, if you find yourself in the position of needing a mass renamer, I recommend trying the ones mentioned here in the reverse order in which I mention them. Probably, pyRenamer will meet your needs, but, if it doesn't for some reason, maybe one of the other ones will.
Emacs can do that!Yes, I know, Emacs can do everthing (TM) and it gets tedious to be told.
wdired mode takes a dired (Emacs file manager) buffer and basically makes it an editable text document. You can use all the Emacs editing tools and macros to make your changes to the file names and file properties and then save the changes to disk. It's incredibly useful and powerful and dired can show multiple directories for you to work in.
A good addition to your articleHi,
I was searching for a good file renamer, and came accross your article. I tried them all but could not achieve what I wanted to : searching files matching against regular expressions, and adding a sequential number to the filenames. None of the applications mentioned in this article could achieve that (KRename maybe, but it was way tooooo slow).
I then found this nice application that can just to what I wanted. It is the Swiss knife of the file renamers. Its name is Métamorphose. It is a cross platform and open source renaming application, so it can run in Linux systems (tried it on debian 6 with no problems at all).
Here is the home page :
It really worthes a try and would help a lot of people to find it in your article.
The whole distro gets rebuilt on glibc 2.3
Ubuntu Vendor tries to solve app packaging and distribution problem across distributions.
Founder of ownCloud launches the Nextcloud project.
Will The Machine change the way future programmers think about memory?
The new Torus distributed storage system is available under an open source license on GitHub
Juries decides Google’s use of Java APIs Was Fair Use
But if you are not using the latest Linux kernel, your system is insecure.
Home routers will give room for custom firmware but still comply with FCC rules
Frank Karlitschek will continue to lead the open source ownCloud project
“Xenial Xerus” comes with a new packages format and several improvements for the enterprise.