Renaming Magically With zmv - The Code Whisperer

I just learned about zmv and I love it. If you already know about zmv or you already love rename, then don’t waste your time reading this.


This is a companion discussion topic for the original entry at http://blog.thecodewhisperer.com/permalink/renaming-magically-with-zmv

I might use sed for that: Generate the "mv" commands, and then execute them.

(Actually, most often, I use vim.)

I typically find it handy to know various ways to do these kinds of tasks, since I never know which option might work best in a given situation. Thanks.

Maybe you could also elaborate a bit on how the parenthesis notation of zmv works together with the parenthesis notation in filename generation. For instance, to include hidden files in a pattern, I might use something like *rc(D) (all files ending in 'rc', including those starting with a dot). According to which rule does zmv know that this (D) is not meant as a pattern undergoing replacement?

I don't know. That sounds like the kind of thing that needs some exploring and an explaining article. These days, I use ranger and its bulkrename feature, which lets me rename a collection of files using a text editor, so I don't need zmv and its cousins like I did when I wrote this article.