Tag Archives: filename

rename: The built-in filename sifting tool

Sorry for the one-day break; Thursdays are always a little bit hectic for me, and this being the last in the month was especially busy.

The bulk of util-linux is splashed across the previous post, but I have a few left over that I want to point out. rename is one of those, and at its best, rename is a quick and speedy tool for bulk renaming files. Here’s what it does, on a good day:


That’s a classy solution for bulk renaming where the same string needs to be substituted out in each file. rename makes it (more or less) a cinch to swap date strings, replace extensions or even make mass insertions and deletions to file names … with a little added command-line kung fu.

rename‘s shortcomings — and you knew I was going to point some out — occasionally crop up, though:


If you look closely, you’ll see that the last file name had its prefix changed, but not the extension. rename caught the first instance of “text,” but quit before it found the other.

rename also has very little in the way of error-checking. Once you send the command, the deed is done … and short of reversing your previous command, there is no preview-and-commit. And you must be cautious that your substitution doesn’t allow for files to be moved onto one another.

And it should probably go without saying that, unless you are a regex grand master, some of the more complex or subtle renaming that is possible with something like renameutils is lost on rename. Which isn’t to say it can’t be done, only to say that your success will depend on your proficiency. 😕

rename works though, and in minor substitutions it’s a breeze. And given its simplicity and straightforward arrangement, I can’t say too many bad things about it. Keep it in mind the next time you dump a couple hundred pictures off your digital camera, and need a system to order them. … 😯

rntools: An unexpected find

I have an application called “rn” in my list but I couldn’t find that anywhere. But I did find something called rntools, while I was digging around.

rntools is probably the safest, least unpredictable renaming tool I’ve seen so far. Even qmv, out of renameutils, has a few quirks that rntools manages to avoid.


For one thing, although rntools is menu-driven, there are some flag options. This is a bonus, since it means you can avoid long, boring command sequences with the menu mode, but also inject it into a script or give it quick commands to complete.

The menus cover a lot of possibilities, from simple case switches to complex search-and-replaces. And after you’ve made your selection and provided it with the info it needs, rntools will double-check that you’re getting the results you want before proceeding.

So you get the opportunity to back out, or reject your changes altogether. Nice touch.

All that is fine and dandy, but I do have a couple of small suggestions.

First of all, it’s no trick to make rntools crash, perhaps most easily by forcing it to rename files to some illegal sequence. I caused havoc just by renaming my data files to something starting with a hyphen, which the underlying rename process took to be a command-line flag.

Second, a couple of the options are a little too cautious. As you can see above, the command to cut characters out of a name asked me to confirm the title each time for each file. That’s not saving me any time if I have a hundred files to plod through, one by one.

On the whole though, rntools is a good option for safer, more meticulous file renaming on a large-scale basis. And hey, it’s got color. Can’t go wrong with that. 😉

P.S.: I only saw rntools in AUR, so Debian users might have to build it on their own. It shouldn’t be too much of a challenge. 😉