Robocopy – File Server Migration

KB ID 0001233


I’ve done a lot of migrations, and moving a client’s files and shared data, usually makes them cringe. 

File Migration

I’ve lost count of the amount of times I’ve heard ‘We can’t have any downtime’, which is fine, until you tell them how much its going to cost to do this on a Saturday! 

As I posted recently, Microsoft have made this a lot easier with the file serve migration tools, which will do the whole thing for you, and migrate profiles, and shares etc.

Windows Server – Migrating Files / Folders / Shares / User Profiles

Thats great, but I find sometimes it’s a little ‘sluggish’ when copying data, and sometimes it’s better to just go ‘old school’  and use Robocopy.


Why Robocopy? Well the advantage to Robocopy, is you can use it to only copy new files or files that have changed. So in a two step procedure, you can do an initial file copy during working hours, then copy the differences out of hours, and repoint people to the new shares.

Tip: Unless you know the network well, always assume there’s some shares you don’t know about, run the fsmgmt.msc tool and expand ‘shares’.

Robocopy Step 1

Just in case things go wrong, I’m going to generate a log of whats going on, so I can see any errors or files skipped when I’ve finished. On the root of the destination servers C: drive create a folder called ROBOCOPY-Logs, and within this folder create another folder called Last-Copy, (you will see why later).

Replace the values in red below, to suit you environment;

robocopy \\OLDSERVER\d$\FOLDER D:\FOLDER /e /zb /copy:DATSOU /r:3 /w:3 /log:c:\ROBOCOPY-Logs\FOLDER.log /V /NP

Where OLDSERVER is the source fileserver, D$ is the drive letter on the Source Server, and D is the drive letter on the new server.

What are those switches doing?

  • /E Copy subdirectories recursively, (including empty ones.)
  • /ZB Use ‘restartable’ mode, and if this fails use ‘backup’ mode.
  • /copy:DATSOU Copy Data, Attributes, Time Stamps, Security, Owner, aUditing information
  • /R:3 Retry three times, if you don’t specify this, it will retry one million times!
  • /W:3 Wait time between the retries above.
  • /log Will output the log to the folder we created above.
  • /V Produce output in verbose (detailed) mode.
  • /NP Do not show percentage progress

Robocopy Step 2

The second time, the command is virtually the same, with one extra switch, (see below).

robocopy \\OLDSERVER\d$\FOLDER D:\FOLDER /e /zb /copy:DATSOU /MIR /r:3 /w:3 /log:c:\ROBOCOPY-Logs\Last-Copy\FOLDER.log /V /NP

  • /MIR This is the ‘mirror directory’ switch, and people are scared of it. Why? Because in the documentation it says it removes or ‘purges’ files. People mistakenly think that it will remove any files from the source that do not exist in the destination. This is incorrect it will only remove files from the destination that no longer exist in the source.


It Has Not Copied Share Permissions!

That’s correct, I never said it would, it copies NTFS permissions, ownership and ACL information. If you want to copy Share permissions then use the smigdeploy tools from the link I posted above.

Can I Copy the Share Permissions Afterwards?

Yes, if you take a look at the following article, (I wrote a while ago,) you can see me doing just that, after a file copy.

Migrating – Folders and Share Permissions

I Can’t Copy Profiles / I get Permissions Errors?

  • Make sure the user you are using to copy files with, is a member of the ‘Backup Operators’ Group.
  • Make sure you execute the Robocopy command from an administrative command window.
  • Try doing the copy from the SOURCE server.


Related Articles, References, Credits, or External Links


Author: PeteLong

Share This Post On


  1. Pete,

    You’re articles have saved my bacon and made my life easier.
    Keep it up please — cause even Sys Admin’s need hero’s!

    Post a Reply
  2. I have used robocopy and it is good but at times it hangs when copying large files I dont know why but its frustrating. I tried to find solution for this but nothing worked. So I decided to try some other software. Then I found GS Richcopy which works like a charm its simple to use does not hangs and provides multi threaded file transfer. Try it its good!

    Post a Reply
  3. I have used robocopy and didn’t find any satisfactory results. It all gets stuck at some point or another, one software which I found interesting and would recommend to anyone is GS RichCopy. Its been 2 years using this and till now no complaints whatsoever. Some of its extra features include NTFS support, multi threaded file transfer, and many more. Its worth the money. Hope it helped you all!

    Post a Reply
  4. Will this kill the shares, or perms on the source server at all?

    Post a Reply
  5. Hi Pete,

    When using Robocopy… if a user moves a file and then you re-run the script, is rebocopy intelligent enough to know the file has been moved and not re-copy? Or will robocopy create a duplicate file?

    Post a Reply
    • Robocopy will change files that have have changed at SOURCE, unless you use the /MIR switch which ‘Mirrors’ changes back from the destination.

      Post a Reply
      • Ok, I appreciate the knowledge in the article but that picture of the SAN above is killing me, what type of SAN array is that?


        Post a Reply
        • It’s not a SAN, it’s a Synergy 12000 Series Blade Center bud 🙂

          Post a Reply
  6. Pete,
    I am migrating two servers from Linux to MS Server 2016. I have tried using the rsync from Linux to MS Server 2016 but it fails. I tried using rsync from Server 2016 to Linux and it also fails. I used the robocopy tool which I have used in the past successfully but this time I am running into an issue where I have to use the credentials of root to access the shares on the samba linux server. Does robocopy support username/password like rsync.

    Post a Reply
    • No Robocopy cannot supply credentials, you would need to ‘net use’ the remote Samba share and embed the credentials there.

      Post a Reply
  7. Pete, great article!

    But I found a Microsoft article very similar. Some differences in the switches. I personally ran /MT:16 you leave it off which gives 8. Whatever as they say etc.

    But they include the following GEM

    /xd DfsrPrivate

    I didn’t use that and ended up copying some useless old Dfsr data that was around 1TB (out of 2.2TB so almost 50% of the time). I would add it to your suggested script.

    Post a Reply
  8. It’s the second Pete’s article that I have used for my admin tasks.

    I really like the simplicity, up to point and concise information.

    Keep it going!

    Post a Reply
  9. Hi Pete. Excellent article, thanks!
    One question: I will be copying from a physical server to a Hyper-V VM. Where should I run the Robocopy? On the source server, the destination VM, or on the VM’s host server?

    Post a Reply
    • In truth it shouldn’t really matter, I always run the command on the newer server, which in most cases is the destination server.

      Post a Reply
  10. Hello Pete, I came back to this page several times again when it comes to Robocopy (the old fashioned way) at customer’s migration jobs, because it simply works. But this time I used it the same way with Windows Server 2019 (Version 10) and it makes problems.
    When using the /MIR switch Robocopy recognized every file as “changed”, even when I re-run it right after first run without /MIR switch. Time is 100% sync using the same NTP server and it’s started from the source server even with mounted Synology NAS shared folder or UNC path.

    Post a Reply
  11. Hello Pete,

    I’ll be doing a migration from old file server to new file server. Would like to know any specific permission that I need to assign to the account that will be used to robocopy folders/files? Because all our file shares are having different permission. Is Domain Administrator sufficient for this move? Or I still need to add this account into Backup Operator?

    Post a Reply
    • Look a the M$ Migration tools – I think they are much more elegant at file server migrations?

      Post a Reply
  12. You stated “Yes, if you take a look at the following article, (I wrote a while ago,) you can see me doing just that, after a file copy”….

    Where is the following article?

    Post a Reply
  13. What a great and time saving article.
    So easy to digest and follow through.

    Got what I was looking for.



    Post a Reply
  14. Hello Pete,

    Excellent article.
    Any possibility for Fileserver migrations between two AD forest, assuming forest trust in place.


    Post a Reply
    • Yes just map a drive, and change the syntax accordingly.

      Post a Reply

Submit a Comment

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