If you have multiple files having an extension like jpeg
and you want to batch rename them to `jpg` as extension you can do that with a single line of code:
FOR /R %f IN (*.jpeg) DO REN "%f" *.jpg
In my case I wanted to batch rename all my template files from `.jade` to `.pug`, as there was an issue with trademarks, so the command would change to:
FOR /R %f IN (*.jade) DO REN "%f" *.pug
Thank you PPOLYZOS.
Please, how would you rename files within subfolders by taking the subfolder name and put it as prefix to filename which is in that subfolder?
For example:
subfolder: “SubFolderName”, original files: “Image1.jpg, Image2.jpg”, output files: “SubFolderName_x.jpg” and “SubFolderName_yz.jpg”
You could generate the commands to rename the files using the following script:
* `%%a`: returns each filespec recursively
* `%%b`: helps make the `folder` as filename
* `%%~nxb`: returns the filename and extension of %%b
* `%%~xa`: returns the .extension of the %%a
Or use a tool like KRename or any alternative to it.
ok, thank you. Meanwhile, I used Bulk rename tool, but would like to try this script. Thanks.
Thank you bro.It saved my time
Much appreciated! This command was just what I required. 🙂
Thank you, this command works and you saved my time
Hats off. Thanks . It works well