Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win


Correct ROBOCOPY Syntax Win2K Server files to Win03 Server Std Edition

Posted on 2004-10-26
Medium Priority
Last Modified: 2008-01-09
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.

Question by:Jeremy-M
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Accepted Solution

HatchIT earned 700 total points
ID: 12419951
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.  :-)
LVL 18

Expert Comment

by:Sham Haque
ID: 12434457
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.

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Finding a job can be stressful - searches, resume tweaks, and networking events can be super boring. Luckily we're here to help you land your dream job!
If you want to move up through the ranks in your technology career, talent and hard work are the bare necessities. But they aren’t enough to make you stand out. Expanding your skills, actively promoting your accomplishments and using promotion st…
The Bounty Board allows you to request an article or video on any technical topic, or fulfill a bounty request to earn points. Watch this video to learn how to use the Bounty Board to get the content you want, earn points, and browse submitted bount…
Articles on a wide range of technology and professional topics are available on Experts Exchange. These resources are written by members, for members, and can be written about any topic you feel passionate about. Learn how to best write an article t…
Suggested Courses

598 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question