Need Robocopy Help.

Posted on 2010-08-21
Last Modified: 2012-05-10
Can someone be so kind as to give me the exact command line for coping files from server A to Sever B?  I need to retain NTFS permissions and log the transfer so that I can make sure everything was copied.
Thank you!
Question by:victor2008
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 12

Accepted Solution

Rant32 earned 250 total points
ID: 33493020
ROBOCOPY "\\ServerA\d$\data" "\\ServerB\e$\destination" /E /COPYALL /LOG+:"c:\copy.log"

If you want to delete files from the destination that no longer exist in the source, add the /PURGE option.

Hope this helps.

Assisted Solution

perplexd earned 125 total points
ID: 33493045
I'd do it like this:

robocopy "C:\server A Folder" "\\server B\C$\Target Folder" /MIR /SEC /V /NP /LOG:"<local log path>" /R:1 /W:2 /NFL /NDL

I run this as a nightly scheduled task to sync files daily until I am ready to cut over the network name. This lets you poke through the log every day and fix any perms or other errors until you are getting clean nightly copies.

Switches detail:

/MIR /SEC mirrors with ACLs copied. /R /W shortens the default wait time for locked files. This was making my jobs take all night at 30 second wait and 10 retries. /NP shows no progress to get rid of spam in your logs. /NFL /NDL are no file or directlory logging because, again, the successful copies are just spam in your log. So, with all this, your log shows you the errors, or just a summary if there was no error.
LVL 12

Assisted Solution

Rant32 earned 250 total points
ID: 33493212
Yes, you get the ACL, but /SEC will not copy Owner information. If the Creator Owner group is used in the ACL, the effective permissions may not be the same. /COPYALL will copy ACL, Owner and Audit attributes.

Lowering the retries and waits from the default is a good idea though.

One other note: I also recommend to run the command as a member of the Backup Operators group on the source server.
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!


Assisted Solution

TechnoButt earned 63 total points
ID: 33497703
As an aside, purely because I"ve hit this recently myself, if your servers are running SMB 2.0 (ie, newer 2008 boxes) and are speaking over Cisco WAAS (ie, replicating files offsite), there is a bug right now that requires code patching oneither the Cisco WAAS or the Microsoft boxes that are both out of band fixes. If this applies, say so, and I'll try to pull the KB article numbers for you.

The reason I mention it, is that NTFS security lookups fail due to the bug, causing robocopy /sec  or robocopy /copyall or similar to fail (despite most file copies ro communications with SMB 2.0 to work fine).  Annoying somewhat rare issue that took me a bit to resolve recently.

This might be a stretch, but I dropped it here in case you run into the issue.

Assisted Solution

johnnytanki earned 62 total points
ID: 33498346
Simple usage as below:

net use v: \\serverA\xxx
net use u: \\serverB\yyy
robocopy v:\ u:\ /e /R:2 /W:1 /z /mir >> log.txt

Where V: drive is the source and U: is the destination. It will mirror what is on V to D: which include the NTFS permission. R is the switch for number of Retries on failed copies and W is the Wait time between retries.

User robocopy /??? for more information.
LVL 12

Assisted Solution

Rant32 earned 250 total points
ID: 33498695
johnnytanki, your command line will certainly not copy file permissions.

Assisted Solution

perplexd earned 125 total points
ID: 33501596
Yes, rant32 is correct, MIR alone will definitely not copy permissions. I never cared about owner permissions in the last few runs I had to do, but I am sure he is right about that as well.
LVL 12

Assisted Solution

Rant32 earned 250 total points
ID: 33504547
Then may I suggest this version, a mix of perplexd's solution and mine?

robocopy "source" "destination" /MIR /COPYALL /NP /LOG:"logfile" /R:1 /W:2 /NFL /NDL

source, destination and logfile can be a local path or UNC path.
/MIR  Copy empty directories and delete files that don't exist in the source (same as /E /PURGE)
/COPYALL  Copy all regular file attributes (RSHA) and security, owner and audit attributes
/NP  No progress
/LOG(+)  Log output to file (use /LOG+: to append to existing file)
/R:1  number of retries
/W:2  Wait time
/NFL  No file list
/NDL  No dir list

I left out /V because it logs skipped files that already exist (spam as well).

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

ADCs have gained traction within the last decade, largely due to increased demand for legacy load balancing appliances to handle more advanced application delivery requirements and improve application performance.
In this article we will learn how to backup a VMware farm using Nakivo Backup & Replication. In this tutorial we will install the software on a Windows 2012 R2 Server.
This tutorial will walk an individual through the steps necessary to enable the VMware\Hyper-V licensed feature of Backup Exec 2012. In addition, how to add a VMware server and configure a backup job. The first step is to acquire the necessary licen…
This tutorial will walk an individual through the process of configuring basic necessities in order to use the 2010 version of Data Protection Manager. These include storage, agents, and protection jobs. Launch Data Protection Manager from the deskt…

627 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