I would like to rename all files in a folder, which have different extensions, to have their file name end with "_1
" while preserving the existing extensions.
I tried ren * *_1*
, which just replaced the last instance of an already-existing underscore in the same to be _1
. I also tried ren * *_1.*
, but this added _1
to the end of file names.
I'm using the command line (typing cmd from the folder search bar) in Windows 10.
Best Answer
You can use a for loop to iterate each file in a directory and specify the variable substitutions individually to get the name of the file minus the extension and the file extension plus the preceding dot. You can use those and add in the
_1
string to get the expected output per each file iterated.Command Line
Batch Script
Further Resources
FOR
Variable Substitutions (FOR /?)
Ren