How to rename multiple *file extensions* to *nil/no file extension* at once in Windows? - eviltoast

In case of renaming multiple file extensions to another, they suggested to type this command in cmd promt or powershell: ren *.(current extension name) *.(new extension name)

But what about to renaming multiple file extensions to nil or no file extension? How to replace this command *.(new extension name) ?

  • Heavybell@lemmy.world
    link
    fedilink
    arrow-up
    13
    ·
    1 year ago

    https://github.com/microsoft/PowerToys

    PowerToys has a bunch of cool features, and a bulk rename utility is one of them.

    Powershell can also do it if you feel like learning more about it. I don’t know about the command example you gave, and am away from my PC so I can’t test it, but using pipes in powershell something like this might work: ls [[insert wildcard here e.g. *.txt]] | % { mv $_ [System.IO.Path]::GetFilenameWithoutExtension($_.Name) }

    Just remove the double brackets and put whatever your filter was. The results of which get passed into % which each in turn into the code block as $_. So for every result of the ls command, it runs mv (move/rename).