I need to rename all files in subdirectories. The names of the subdirectories are different, the file names are different, but they are always JPG files. I need a BAT script that will change the names to the current date with the next digit at the end in each directory, ie: 2021-01-05_1.jpg 2021-01-05_2.jpg etc. I found such a script on this website, I rewritten it a bit and it works perfectly but not in subdirectories. Is it possible to modify it to do it also in subdirectories?
@echo off
setlocal EnableDelayedExpansion
set filename=%DATE%
set suffix=1000
for /F "delims=" %%i in ('dir /B *.jpg') do (
set /A suffix+=1
ren "%%i" "%filename%_!suffix:~1!.jpg"
)
/s
to thedir
command.