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?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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 . . .
from here you can get all the information

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

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 -
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Storage Software

From novice to tech pro — start learning today.