• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1407
  • Last Modified:

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.

1 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.  :-)
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.
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.

Join & Write a Comment

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now