Robocopy – Moving My Documents

email me

Moving My Documents to a subfolder

The For command will cycle the the My Documents folder performing the robocopy command on each item. FOR conditionally performs any command or a specified sequence of commands multiple times.

for /d %%Y in (Sta??) do (for /f “usebackq tokens=*” %%U in (‘dir /b /ad “%%~Y\*”‘) do (robocopy.exe “%%~Y\%%~U” “%%~Y\%%~U\Documents” /e /move /xd “Documents”))

Reference: http://ss64.com/nt/for.html   http://ss64.com/nt/robocopy.html