Robocopy Bat files

I’m trying to create a bat file to copy over folders and file with Robocopy in Windows XP but not sure how the command would go.
I have a external drive with the drive letter G:
I want to copy these DIRs when running a bat file
C:\Documents and Settings\user\My Documents
to the external drive in folders I created in this path

This is what I came up with but it’s not working

RoboCopy /Mir C:\MYMAIL G:\Backup\Week-Backup\Week1 /E /COPYALL
RoboCopy /Mir C:\Documents and Settings\user\My Documents  G:\Backup\Week-Backup\Week1 /E /COPYALL


Who is Participating?
farjadarshadConnect With a Mentor Commented:
from here you can get all the information
correct syntax is robocopy source destination *.* /mir /copyall /e

This would mirror your data to the external. Just substitute your file paths in the source and destination.
ahmad1467Author Commented:
this is what I tryed but it didn't work
robocopy C:\MYMAIL G:\Backup\Week-Backup\Week2 *.* /mir /copyall /e

this is what showed when it ran

C:\Documents and Settings\ahmad\Desktop>robocopy C:\MYMAIL G:\Backup\Week-Backu
\Week2 *.* /mir /copyall /e

   ROBOCOPY     ::     Robust File Copy for Windows     ::     Version XP010

  Started : Wed Mar 31 22:52:24 2010

   Source : C:\MYMAIL\
     Dest : G:\Backup\Week-Backup\Week2\

    Files : *.*

  Options : *.* /S /E /COPYALL /PURGE /MIR /R:1000000 /W:30


                           0    C:\MYMAIL\


                Total    Copied   Skipped  Mismatch    FAILED    Extras
     Dirs :         1         0         1         0         0         0
    Files :         0         0         0         0         0         0
    Bytes :         0         0         0         0         0         0
    Times :   0:00:00   0:00:00                       0:00:00   0:00:00

    Ended : Wed Mar 31 22:52:24 2010

C:\Documents and Settings\ahmad\Desktop>pause
Press any key to continue . . .
The new generation of project management tools

With’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

is there anything in the mymail folder? that command tests fine even without the *.*
If there is no change in the contents you get the message that it skipped (because it is mirroring)
robocopy C:\MYMAIL G:\Backup\Week-Backup\Week2 *.* /mir /copyall /dcopy:T /b

although i would use something like this:

robocopy C:\MYMAIL G:\Backup\Week-Backup\Week2 *.* /e /copyall /dcopy:T /m /b

and only run the /mir version every so often to clean out the remote copy. prevents sudden 'mistakes'.

with the /m option for first backup you have to select 'files are ready for archiving' in files properties. you can set it on the top level folder and apply to all children.
if using win 2003/2000 you should use ntbackup though to backup the files onto a local drive. then robocopy the backup files over to a remote machine. on win2008, use windows server backup. both can be controlled by commandline.
oh i forgot to mention WHY. because robocopy will not shadow copy the volume, so any open files will not be backed up.
From what your log states, there aren't any files located in C:\MYMAIL. Either that, or you may not have access to the file? Try this: ROBOCOPY C:\MYMAIL G:\Backup\Week-Backup\Week1  /MIR /COPYALL /E /ZB

Alternative Solution: Use Microsoft SyncToy -
All Courses

From novice to tech pro — start learning today.