for /D /r %%f in (*) do (
недопустимая комбинация, смотрите вывод с эхом.
- Вы можете сложить два,
for /D
чтобы перебрать сначала,picsfrom..
а затем подпапки или for /f
Выход разборе реж фильтруется с регулярным выражением ($ анкеры в конце), чтобы соответствовать только желает подпапки с Findstr:
@Echo off Set "Folders=view_pictures$ personal_pictures$ scenic_pictures$" For /f "delims=" %%F in ( 'Dir /B/S/AD ^|Findstr /I "%Folders%"' ) Do Ren "%%~fF" "2017_%%~nxF"
Пример дерева на моем ramdrive A:
> tree A:\ └───root path ├───picsfromA │ ├───2017_personal_pictures │ └───2017_view_pictures ├───picsfromB │ ├───2017_personal_pictures │ ├───2017_scenic_pictures │ └───2017_view_pictures ├───picsfromC │ ├───2017_personal_pictures │ └───2017_scenic_pictures ├───picsfromD │ └───2017_personal_pictures └───picsfromN └───2017_scenic_pictures
РЕДАКТИРОВАТЬ Вывод for /D /r %%A in (*) do Echo:%%A
на моей системе
A:\root path\picsfromA A:\root path\picsfromB A:\root path\picsfromC A:\root path\picsfromD A:\root path\picsfromN A:\root path\picsfromA\2017_personal_pictures:A:\root path\picsfromN A:\root path\picsfromA\2017_view_pictures:A:\root path\picsfromN A:\root path\picsfromB\2017_personal_pictures:A:\root path\picsfromN A:\root path\picsfromB\2017_scenic_pictures:A:\root path\picsfromN A:\root path\picsfromB\2017_view_pictures:A:\root path\picsfromN A:\root path\picsfromC\2017_personal_pictures:A:\root path\picsfromN A:\root path\picsfromC\2017_scenic_pictures:A:\root path\picsfromN A:\root path\picsfromD\2017_personal_pictures:A:\root path\picsfromN A:\root path\picsfromN\2017_scenic_pictures:A:\root path\picsfromN