2026-07-21
Every few years someone rediscovers vidir from moreutils and posts it like it's magic. It's fine. But there's an older, sharper tool for the same itch that almost nobody installs: Oleg Broytmann's renameutils, shipped since 2001 as qmv, qcp, imv, and icp. The killer feature isn't the editor integration — it's that qmv knows how to unpick rename cycles without clobbering your data.
Basic usage looks like every other editor-based renamer:
qmv *.jpg # opens $EDITOR with a two-column list
The default --format=destination mode is where it earns its keep. You get two tab-separated columns: source on the left (read-only), destination on the right (edit freely).
DSC_0001.jpg DSC_0001.jpg
DSC_0002.jpg DSC_0002.jpg
DSC_0003.jpg DSC_0003.jpg
Do a :%s/DSC_/vacation-2026-/ in vim and save. Done. But now try the party trick — swap two files:
a.txt b.txt
b.txt a.txt
mv can't do this. vidir processes line by line and mangles it. mmv requires you to spell out a pattern. qmv detects the cycle, inserts a temp file, and executes a.txt → tmp → b.txt → a.txt in the right order. Same for three-way swaps, four-way, arbitrarily long chains — you edit the target column and it figures out ordering.
The under-appreciated flags:
qmv -f do — "destination-only" mode. Editor shows just filenames; original list is comments. Great for terse edits.qmv -f dv — "dual" mode (default). Two columns.qmv -R photos/ — recursive.qmv --editor=nvim — override $EDITOR per invocation.vidir, which unlinks anything you remove).qcp is identical but copies instead of moves. imv and icp are single-file variants with readline editing on the target name — the fastest way to rename a file with a long, awkward name you don't want to retype:
$ imv "Screenshot from 2026-07-21 09-14-33.png"
Rename to: Screenshot from 2026-07-21 09-14-33.png
^^^ full readline editing here — cursor, kill-word, tab-complete
Real workflow I use constantly — pull a CSV of new filenames from somewhere, feed it in:
ls *.pdf | paste - new-names.txt \
| qmv -f do - # read from stdin, edit-approve, execute
The - stdin support means you can pipe in a plan generated by any script and use qmv just as the interactive confirm-and-execute step, with cycle handling as a bonus.
What it does better than the alternatives:
mv: batch, in an editor, with all the power of your editor's regex.mmv: no pattern language to memorize; you just edit text.vidir: handles cycles; doesn't treat deleted lines as "delete the file."Install via apt install renameutils, brew install renameutils, or your distro's equivalent. It's ~1000 lines of C. Twenty-five years old. Still perfect.
qmv gives you your editor's full power plus the one thing every other renamer gets wrong — safely resolving cyclic renames without a manual temp-file dance.
