mved uses your favourite text editor to rename many files at the same time.
- Run mved with a list of files as arguments. Usually just " mved * "
- Your editor opens with each file name on one line. Edit those lines and/or swap them around.
- Save and exit from your editor. Now all your edits become actual file renames, and a listing of the renames made is written to standard output. If push comes to shove, this listing can help undoing mistakes.
mved takes care of circular renaming, so you don't need to worry.
I helped stsp write this Python script many years back in 2004, and I'm still using it quite often. It was part of the gentoo distribution at one time, and ghcif.de mentions it.
By the way, I recently noticed that vidir (on debian and related systems contained in the moreutils package) is a widely packaged program that's quite similar to mved. However, vidir has line numbers in the file-to-be-edited, and I prefer mved without those numbers, as I feel they are getting in the way of my editing. For example, if I want to swap two file names with mved, I can simply swap the two lines. In vidir, I have to edit the line numbers, which IMHO is a bit less practical. I also prefer getting a comprehensive listing of which renames have taken place, as mved writes to stdout, which vidir does not feature.