I made this batch file that makes a folder named Pictures and puts all the .jpg files in it.
@echo off
md Pictures
for %%i in ("*.jpg") do (
move /Y "%%i" "Pictures" )
end
Is there anyway to make the script iterate through subdirectories as well? I want to run the batch file on a root directory and make it work for all subfolders.
Based upon the answer you've supplied, I would suggest you could do that like this, in a single line batch-file:
@For /D %%G In (*) Do @"%__AppDir__%Robocopy.exe" "%%G" "%%G\Pictures" *.jpg /Mov >NUL 2>&1
As an alternative, because For /D
may not pick up all of your directories, (it ignores directories with the hidden and system attributes):
@For /F "EOL=? Delims=" %%G In ('Dir /B /AD') Do @"%__AppDir__%Robocopy.exe" "%%G" "%%G\Pictures" *.jpg /Mov >NUL 2>&1