Greetings,
I have a written a Robocopy bat file to back up the files on my laptop to a portable USB connected drive. I had some issues with the date functions but got that straightened out. However the file is not doing what I thought. Here is the file:
@Echo Off
Echo.
Echo.
Echo You must run this file by right clicking and run as Administrator.
Echo If not you won't get all the files. Crtl C exits.
Echo.
Echo.
If exist E:\ (Echo. External USB HD ready for BackUp) else (Echo. No External USB HD detected & Goto :EOF)
Echo.
pause
Echo.
For /f "tokens=2-4 delims=/ " %%a in ('date /t') do (set ToDay=%%c-%%a-%%b)
Robocopy "C:\Users\%UserName%\Favorites" "E:\Joe_BackUp-%ToDay%\Favorites" /E /Z /XA:H /R:10 /W:20
Robocopy "C:\Users\%UserName%\Desktop" "E:\Joe_BackUp_%ToDay%\Desktop" *.bat /XA:H /R:10 /W:20
Robocopy "C:\Users\%UserName%\Documents" "E:\Joe_BackUp_%ToDay%\My Documents" /E /Z /XA:H /R:10 /W:20
Robocopy "C:\Users\%UserName%\AppData\Local\Microsoft\Windows Live Mail" "E:\Joe_BackUp_%ToDay%\Windows Mail" /E/Z /XA:H /R:10 /W:20
Robocopy "C:\Xnews_test 2006.06.28" "E:\Joe_BackUp_%ToDay%\XNEWS" /E /R:10 /W:20
Set ToDay=
::END_OF_BATCH
Echo.
Echo.
Echo. All Done
pause
Here is the issue. I was expecting that I would end up with one folder on the backup drive and that there would be these sub-folders: Favorites, Desktop, My Documents, Windows Live Mail, and XNEWS. What I end up with is two dated folders one contains Desktop, My Documents, Windows Live Mail, and XNEWS subfolders and the other contains Favorites subfolder.
Can someone help me to get all the copied files in their subfolders under one backup folder? I am afraid my staring at the bat file has not found anything obvious so there is something I don't understand about ROBOCOPY.
Thanks in advance for your help!
I have a written a Robocopy bat file to back up the files on my laptop to a portable USB connected drive. I had some issues with the date functions but got that straightened out. However the file is not doing what I thought. Here is the file:
@Echo Off
Echo.
Echo.
Echo You must run this file by right clicking and run as Administrator.
Echo If not you won't get all the files. Crtl C exits.
Echo.
Echo.
If exist E:\ (Echo. External USB HD ready for BackUp) else (Echo. No External USB HD detected & Goto :EOF)
Echo.
pause
Echo.
For /f "tokens=2-4 delims=/ " %%a in ('date /t') do (set ToDay=%%c-%%a-%%b)
Robocopy "C:\Users\%UserName%\Favorites" "E:\Joe_BackUp-%ToDay%\Favorites" /E /Z /XA:H /R:10 /W:20
Robocopy "C:\Users\%UserName%\Desktop" "E:\Joe_BackUp_%ToDay%\Desktop" *.bat /XA:H /R:10 /W:20
Robocopy "C:\Users\%UserName%\Documents" "E:\Joe_BackUp_%ToDay%\My Documents" /E /Z /XA:H /R:10 /W:20
Robocopy "C:\Users\%UserName%\AppData\Local\Microsoft\Windows Live Mail" "E:\Joe_BackUp_%ToDay%\Windows Mail" /E/Z /XA:H /R:10 /W:20
Robocopy "C:\Xnews_test 2006.06.28" "E:\Joe_BackUp_%ToDay%\XNEWS" /E /R:10 /W:20
Set ToDay=
::END_OF_BATCH
Echo.
Echo.
Echo. All Done
pause
Here is the issue. I was expecting that I would end up with one folder on the backup drive and that there would be these sub-folders: Favorites, Desktop, My Documents, Windows Live Mail, and XNEWS. What I end up with is two dated folders one contains Desktop, My Documents, Windows Live Mail, and XNEWS subfolders and the other contains Favorites subfolder.
Can someone help me to get all the copied files in their subfolders under one backup folder? I am afraid my staring at the bat file has not found anything obvious so there is something I don't understand about ROBOCOPY.
Thanks in advance for your help!