Reputation: 13
I tried with the below command but is cuts some part of file n replace the _TEST.pdf with it
FOR /R %f IN (*.pdf) DO REN "%f" *_TEST.pdf
EX:
Orgininal file name is TEST_123.pdf
Renamed file name is TEST_TEST.pdf
Expected result is TEST_123_TEST.pdf
Upvotes: 1
Views: 23
Reputation: 56180
use modifiers (see for/?
):
FOR /R %f IN (*.pdf) DO REN "%~ff" "%~nf_TEST%~xf"
this is command line syntax. To use it in a batch file, double each %
:
FOR /R %%f IN (*.pdf) DO REN "%%~ff" "%%~nf_TEST%%~xf"
Upvotes: 1