Correct ROBOCOPY Syntax Win2K Server files to Win03 Server Std Edition

Posted on 2004-10-26
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
    LVL 1

    Accepted Solution

    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
    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.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

     Java Android Coding Bundle

    Whether you're an Apple user or Android addict, learning to code for the Android platform is an extremely valuable, in-demand skill. It all starts with Java, the language behind the apps and games that make Android the top platform it is today.

    Suggested Solutions

    Title # Comments Views Activity
    SAP PM 5 45
    Error in calculation 2 33
    Independent Events 4 37
    Reading variable length EBCDIC in SAS 9 42
    I really like Experts Exchange but the text formatting tags are pretty basic. For example in an article I wrote I found that when I put a "[bullet]" tag in front of a list of items and a closing "[]/bullet]" tag at the end I expected that each item …
    Surprisingly, there is a lot to Gym battles, and I thought it would be helpful to share knowledge about all the ins and outs of this feature!
    Saved searches can save you time by quickly referencing commonly searched terms on any topic. Whether you are looking for questions you can answer or hoping to learn about a specific issue, a saved search can help you get the most out of your time o…
    Where to go on the main page to find the job listings. How to apply to a job that you are interested in from the list that is featured on our Careers page.

    857 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

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now