Bulk Rename Files in Linux

There are many ways to bulk rename files in Linux. Some with command line magic, some via a graphical user interface. A useful utility that I have found is something kind of in between both methods.

First, you must install renameutils and use qmv with your favorite text editor. In Ubuntu this can be done with sudo apt install renameutils but depending on your distribution you may need to install via different command lines.

Next, qmv loads all names in your editor and when you save and close it applies your changes to the actual files. If the changes are inconsistent (e.g. two files get the same name) it will abort without touching anything. It also handles circular renames correctly. I usually do:

$ qmv -f do

So that it shows just one column of names (do: destination-only). Here’s how it looks:

qmv -f do in vi editor

If you combine it with the multiple cursors of SublimeText, Atom or Visual Studio Code, it makes a very nice and powerful tool for bulk renaming. For instance, for Atom, you would do EDITOR="atom -w" qmv -f do.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s