I have a folder "Main" inside that i have multiple folders "foo","fooxyz" and so on, each folder has around 10-20k files.
I wanted to replace a string in all the files. so basically i had to deal with For /R in "Main", I tried the following code with the help of questions asked but i am not sure what needs to be done exactly.
Setlocal enabledelayedexpansion
Set "Pattern=.jpg"
Set "Replace=_main.jpg"
For /R C:\Main\ %%# in ("*.jpg") Do (
Set "File=%%~nx#"
Ren "%%#" "!File:%Pattern%=%Replace%!"
)
If my code can be corrected well and good if not kindly point me in the right direction.