Batch renaming files in Windows.
21 Mar 2022I don’t do any development work on Windows. When a collaborator asked me how to rename a bunch of files on Windows, I didn’t know how to do it.
Thankfully, there’s an easy way with the command line – source is windows-commandline.com.
I was mostly interested in adding a prefix. Here, all of the .jpg
files in a directory and its subdirectories are renamed, with a prefix added to the filename of 03-21
.
forfiles /S /M *.jpg /C "cmd /c rename @file 03-21-@file"