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. …😯