Robocopy (FileServer Migration)

I often use Robocopy when migrating/copying data from file servers.

When running the copy process to transfer data from Windows Server 2003 to Windows Server 2008 I usually run robocopy from the destination server (usually the newer server) in order that it will use version XP027 (5.1.10) There are a number of flaws in XP026 and also requires a seperate download Windows 2003 Resource Kit to obtain it.

This is the main syntax I use to perform a full copy.

robocopy D:\Source E:\Destination /MIR /R:1 /W:1 /COPYALL

Example, when copying from another server (using UNC):

robocopy \\myserver\e$\data E:\data /MIR /R:1 /W:1 /COPYALL

Although “/MIR” is mirroring the data, this will not actually copy the ACL permissions, therefore you will need to ensure that /COPYALL is included. I’ve copied a whole load of data before without including this only to find I have had to recopy to correct the ACL.

/COPYALL : Copy ALL file info (equivalent to /COPY:DATSOU) including timescamps, permissions, ACL, other attributes.
/MIR : MIRror a directory tree – equivalent to /PURGE plus all subfolders (/E)
/R:n : Number of Retries on failed copies – default is 1 million.
/W:n : Wait time between retries – default is 30 seconds.

Sometimes the copy may set the top level folder to “hidden” This can be un-hidden using the “attrib” command:

attrib -h -s E:\data

-s : Removes the system file attribute.
-h : Removes the hidden file attribute.

For reference this is the old method I used to use with the “xcopy” command, usually if robocopy is unavailable.

This command will copy all files, including those in sub-folders, that are newer in the source folder. It will copy hidden as well as read-only files and will create the destination folder and/or sub-folders if they do not already exist.

  • xcopy C:\*.* E:\setdir /D /E /C /R /H /I /K /Y
  • robocopy.exe C:\ E:\Backup /XO /COPYALL /LOG:E:\BackupLog.txt (Created a logfile in e:\)

Perform flat copy:

  • XCopy d:\*.* C:\CD-copy\ /v /s /h

Switches:

  • /d – date Copies files changed on or after the specified date.
  • /e – Copies any subfolder, even if it is empty.
  • /c – Continues copying even if errors occur.
  • /r – Overwrites read-only files.
  • /h – Copies hidden and system files.
  • /i – If the destination does not exist, and you are copying more than one file, this switch assumes that the destination is a folder.
  • /k – Copies attributes. Typical xcopy commands reset read-only attributes.
  • /y – Overwrites existing files without prompting you.
  • /v – verification
  • /s – subfolder or directories
  • /h – hidden files

Source: http://support.microsoft.com/kb/289483 (xcopy switches)

One thought on “Robocopy (FileServer Migration)

  1. Darwin

    Robocopy is great but it is a headache for not techy users, so using GUI tools like Gs Richcopy 360 and Teracopy is more easy and fast

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.