2021-10-16

ZMV ON WINDOWS!?? [NOT CLICKBAIT]

    Hello netizens. I use Windows now, which means I have to use PowerShell. It's actually pretty neat once you get past the bizarre Verb-Noun command format.

    But, this means I can't use such great features as zmv, which I wrote about in a previous blog post. (I spent five minutes thinking of funny ways to ridicule the fact that I'm not linking to that blog post here but couldn't think of anything worthwhile.)

    Or can I? Well, duh, of course I can. zmv is just a funky little function. I can make my own damn functions on Windows.

    Let's use my previous example of renaming "Artist name - Album title - Track # Track name.flac" to "Artist/Album/# Track.flac" — SHIT, I mean "Artist\Album\# Track.flac". Sorry Gates.

    BEHOLD: zmv for Windows.

Get-ChildItem . | Rename-Item -NewName { $_.Name -replace '^(.*) - (.*) - (.*)','$1\$2\$3' }

    It's a bit more complicated, sure, but it works. Thanks, StackOverflow!

    (Really this series of blog posts is just me learning regex but that doesn't mean I can't look cool while doing it.)



    P.S. While figuring out how to pick PowerShell's background color, I learned that Microsoft PowerToys has a tool for doing regex renames with a fancy GUI, called PowerRename. Freakin awesome!!


    Only problem is that it's not integrated with Windows 11's new context menu (yet?)