Ever been faced with a collection of files that need renaming and nearly gone mad from trying to do it manually? Lots of typing mv, or lots of right click -> rename. Enter qmv, part of renameutils. Suppose we have a bunch of mp3s that require renaming:
$ ls<br /> track10.mp3 track12.mp3 track2.mp3 track4.mp3 track6.mp3 track8.mp3<br /> track11.mp3 track1.mp3 track3.mp3 track5.mp3 track7.mp3 track9.mp3
qmv allows us to edit the names in a text editor, defaulting to your $EDITOR, but you can specify a different editor if you prefer.
$ qmv --editor=emacs *<br />
In the default format, there are two columns, the left being the original file name and the right being the names of the destinations, allowing the name mapping to be explicit at all times
On saving and closing the file, qmv follows the mapping you laid out.
$ ls<br /> 01-Kill_The_lights.mp3 05-Redstars.mp3 09-To_Die_For.mp3<br /> 02-Goodnight.mp3 06-Looking_Glass.mp3 10-Walking_With_Strangers.mp3<br /> 03-Falling_Down.mp3 07-Science.mp3 11-Weekend.mp3<br /> 04-Unfamilliar.mp3 08-Remember_Me.mp3 12-Movie.mp3
Of course there are all kinds of tricks you can do with find/replace and regular expressions, but with the default format the input filenames get in the way, but qmv has a trick up its sleeve:
qmv -f destination-only *
Now we can use M-x replace-string to replace the '-' with '-The_Birthday_Massacre-Walking_With_Strangers-' to add in the band and album name. Of course with the power of some text editors the possibilities are endless.
Also included in the renameutils package are imv, which uses readline for a less complex but still interactive move, the equivalents for copying, qcp and icp, and deurlname which replaces url-encoded characters with the decoded character.








Add new comment