Move a file share to a new server using Robocopy

Robocopy is a command line tool that has been around for years, but is still really useful today. It is part of the Windows Server Resource Kit Tools. You will need to install these in order to use the robocopy command. Essentially it is a tool for copying files from one location to another, but with some significant extra advantages over the standard xcopy command. The main advantages that I can see are these:

  • The ability to copy NTFS permissions, if you want to
  • The ability to skip files that have been copied previously, provided that they have not changed

For the reasons above it is still ideal for using when you want to quickly migrate the contents of a file share to a new server. To do this first set up the new file share on the new destination server, making sure the share and NTFS permissions match those that are configured on the old share on the old server.

Next enter the following command in a new batch file, where OLDSERVER is the old file server name, and OLDSHARE is the old share name, and NEWSERVER is the new server name and NEWSHARE is the new share name:


The command basically tells robocopy to copy the contents from the UNC path of the old share, to the UNC path of the new share. The /S and /E tell robocopy to copy any subdirectories, and empty directories. In this example the /COPY:DATS tells robocopy to copy the Data, Attributes, Timestamps and Security information. There are a couple of other elements that you can also copy if you want. To copy everything use /COPY:DATSOU or alternatively /COPYALL. Here is a list of all the flags you can use with the /COPY: part of the command:

D – Data

A – Attributes

T – Timestamps

S – Security i.e. NTFS permissions

O – Owner information

U – Auditing information

The beauty of this solution is that you can run this script during the day, when users are on the system to do the initial copy which depending on how much data is in the share could take a while (that said, this is obviously not a good idea if you are copying the contents to a remote server over a slow WAN link). Then out of hours you can run the script again, but this time it will only copy any files which have changed since the last copy making the copy process a lot quicker. Then all you need to do is change the path for any drive mappings you have in your login script, or group policy preferences, to point to the new file share on the new server. When your users come in the following day, they will will be blissfully unaware that the data has been relocated.

Robocopy has other uses too, and various other options check the help information for more details using:

robocopy /?  


9 Responses to Move a file share to a new server using Robocopy

  1. Very well written article! Do you have a write up on using RoboCopy Gui, or Secure Copy by SciptLogic?

    • oasysadmin says:

      Thanks Jose, I have only tried using the robocopy GUI once ,and I didn’t really find the the GUI added anything of value.

      Sorry, I have not used Secure Copy, but have just looked it up. Looks like it performs a similar job.

  2. cc says:

    As a long time user of the old XCOPY and several 3rd party utilities, ROBOCOPY is a great replacement for all my other copy tools! This Resource Toolkit should be standard in every windows OS! Thanks!

  3. Pingback: Hard Disk Space - Page 2

  4. Robert Tate says:

    I am about to move our file server to another server.(Hyper-V to vmware). It is a very large server so conversion is not an option.I was wondering if you could tell me about doing a sync only run after the initial copy or can the same command be run again? Here is the command I am using for the initial copy: robocopy \\Source\m$\Users \\Destination\E$\Users /S /E /COPY:DATSOU /R:1 /W:30 >C:\robocopy.log . I am new to this so any advice\help would be appreciated.

  5. I have successfully moved the file share to the new server and everything works great. I deleted the old server from AD prior to bringing the new one up. I have now renamed the old server and given it a new IP but when I bring it up it kills the shares to the new server. Any thoughts on how to fix this? I want to re-purpose the old server just for backups.

    • Scott Upham says:

      Did you rename the new server to the old server name? If you named the server something other than the old server name you will need to modify any login scripts or drive mapping to the server.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: