I’ve written about this many times before but it’s so useful it bears repeating. It’s about a technique I use all the time and one that I’m sure the rest of you will find worthwhile too. This post is inspired by one from Alain Lafon, a master Emacs user, about whom I’ve written several times.
The idea is simple. If you’re an Emacs user and want to rename a file, the easiest way to do that is to use dired from within Emacs. But what if you want to rename several, similarly named files? The answer is the same except that you have to turn on wdired mode (Ctrl+x Ctrl+q by default). Once you’ve entered wdired mode, the changes you make to the dired listing are reflected back to the actual files. So all you have to do is turn on wdired mode and use your favorite search replace method to change the target file names. Then you simply type Ctrl+c Ctrl+c to exit wdired mode and rename the files.
Lafon’s post has an animated GIF that demonstrates the process but the easiest way to see how it works is to try it out yourself. It really is a trick worth knowing.