Correct ROBOCOPY Syntax Win2K Server files to Win03 Server Std Edition

I'm having trouble with the robocopy command.

I want to copy all files and files in a directoty or drive on one server to another server including, attributes, tims stamps, NTFS security info and ownership info. I want to copy the entire directory tree including empty directories.  I just cannot seem to get the syntax right.

For example, C: D: *.* /COPYALL creates the directory but no files and the Security is wrong.

For example, C: D: *.* /S/E Invalid Parameter #4

For example, C: D: *.* /S/E Invalid Parameter #4

For example, C: D: *.* /S/E/COPYALL Nothing happens

For example, C: D: *.* /S/E/COPYALL This command copies all the folders, subfolders and file but the security permissions are wrong.

For example, C: D: *.* /S/E/COPY:/DATSU Invalid Parameter #4

I am copying files from a Windows 2000 Server to a Windows 2003 Server (Std Edition)

Can someone give me the correct syntax to copy all the folders, subfolders (the entire directory tree with Data, Attributes, Timestamps, NTFS Security, NTFS Auditing Information that will work correctly.

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.

Should be:

robocopy <source> <destination> /e /sec

I'd also suggest adding:

robocopy <source> <destination> /e /z /sec /r:5 /w:1 /reg /v /eta /log:<logfile>

/e = including subdirs, even if empty (the /s excludes empty folders)
/z = copy in "restartable" mode, meaning that if, for any reason, the file doesn't make it, it'll try again, continuing where it left off
/r:5 = retry 5 times before giving up (robocopy's default is insane)
/w:1 = wait one second between retries (robocopy's default is insane)
/reg = write the retry and wait values to the registry, where it will read it next time robocopy is run and use those as defaults
/v = verbose mode, lots of info here
/eta = "Estimated Time of Arrival", or what time it thinks the file will be done copying
/log:<logfile> = instead of outputing to the screen, output to <logfile>

If the files already exist there, but you want to update NTFS security information that may have changed, use /secfix instead of /sec.  I'm not sure if it'll copy the NTFS Auditing info, but if robocopy can do it, then /sec or /secfix will be what you use.  The timestamps should be done by default.  If by attributes you mean read-only, hidden, system, etc, I think it does that by default as well.

One other thing: if you're going to be doing this frequently on the same folder(s), then you'll probably want to use the /mir switch instead of /e.  This will remove any files that exist on the destination that no longer exist in the source.  BE CAREFUL WITH THIS.  I've screwed things up pretty badly with this switch.  :-/

This is all for robocopy v1.95, from the WinNT 4.0 Resource Kit.  My version doesn't have /copyall, so I'm not sure what it does.  Hope this all helps.  :-)

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
Sham HaqueSenior SAP CRM ConsultantCommented:
this from the ROBOCOPY readme:

True Replication

If you require the destination directory tree to be maintained as an exact mirror of the source directory tree, and have files and directories deleted from the destination whenever they disappear from the source, you can use the /PURGE switch (at your own risk).

/PURGE causes Robocopy to delete ALL Extra and Mismatched destination files and directories. After a Mismatched destination entry has been deleted, the corresponding source entry is then treated as a Lonely file or directory, and processed accordingly.

Where /PURGE results in the deletion of an Extra or Mismatched  destination directory, the entire directory tree, including all subordinate files and subdirectories, will be deleted.

You should use /PURGE with extreme caution. If you specify /PURGE along with an incorrect (but existing) destination directory, Robocopy WILL DELETE lots of data from the destination very quickly.  You use the /PURGE option at your own risk.

Note that the /XX switch excludes Extra files from further processing, so /PURGE will have no effect if /XX is also used.
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

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.