[Last Call] Learn how to a build a cloud-first strategyRegister Now


Robocopy Parameters

Posted on 2011-04-25
Medium Priority
Last Modified: 2012-05-11
I am trying to copy a very large directory structure (400GB) including sub-directories from one location to another location using Robocopy.

However the copy process fails on a few files which means the whole copy operation fails.

Can anyone suggest the exact syntax/parameters which will allow the copy process to continue if particular files fail but where the names of the failing files will be logged to a text file which can be reviewed at a later date.
Question by:Chrissycan
LVL 19

Assisted Solution

by:Miguel Angel Perez Muñoz
Miguel Angel Perez Muñoz earned 320 total points
ID: 35458979
This works for me:

c:\robocopy\robocopy.exe "Origin" "Destination" /E /COPYALL /XO /LOG:logfile.txt

Copy all, if a error found don´t stop copy and all process is recorded on a logfile.
LVL 85

Expert Comment

ID: 35459043
robocopy's behavior on failing files is governed by the /r (retry, default 1 million) and /w (wait, default 30 seconds) parameters; they tell robocopy how often to retry a copy operation, and how long to wait (in seconds) between retry attempts. The default values will make robocopy wait for a really long time in cas eof an error, so these need to be reduced. If it's a stable LAN connection, set both to 0.
As far as logging is concerned, you can usually safely use /nfl (no file logging) and /ndl (no directory logging); this will only disable logging of successfully copied files, errors will always be logged. And if you're writing to a log file, use /np (no progress indicator), as this will clutter up the log file with control characters. Use /tee to have console output as well as logfile output.
It's no problem to start robocopy several times; it will by default only copy files that aren't in the target already. If you want to delete files in the target that don't exist in the source anymore (to have identical folder trees), use /mir (includes /e).
robocopy will by default only copy the file data, attributes, and time stamp. (/copy:DAT). For NTFS permissions, add a "S", for Owner an "O", for aUdit an U (shortcut to copy everything is /copyall).
So I'm usually using something like this:
robocopy "S:\ource\Folder" "T:\arget\Folder" *.* /copy:DATSOU /r:0 /w:0 /np /mir /nfl /tee /log:"robocopy-20110425-0325.log"

Open in new window

If you've installed the W2k3 Resource Kit to work with robocopy, check out robocopy.doc in the installation folder, it's a very useful documentation (which was dropped for whatever reason in Vista or later where robocopy is preinstalled).
LVL 25

Assisted Solution

by:Tony Giangreco
Tony Giangreco earned 80 total points
ID: 35459159
It sounds like you are trying to copy files that are in use. You might want to add a few commands to stop the services for that app first then restart the services when the robocopy process completes. Put your actual services and robocopy command in a .cmd file and run it.

Something like this:

net stop "automatic updates"
net stop ....
net start "automatic updates:
net start .....
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.


Author Comment

ID: 35459820
Thanks all for your comments. I'm going to try these and will post back. It will be a while because there are a very large number of files to copy. They are being copied to a NAS Unit.

Author Comment

ID: 35460761

I read your comment and that was indeed the problem I had when I first used Robocopy i.e. it kept displaying waiting 30 seconds when it encountered a problem and never seemed to go beyond that.

I tried your command but it kept giving Access Denied 0X00000005 errors. I googled it and some suggested using copy:DT rather than Copy:DATSOU. This I have found allows the copy process to run.  

I would prefer to stick to your original syntax as much as possible as you obviously know what you are talking about. However I am concerned whether the destination structure will then be exactly the same as the source should a user start to access it.



 The rest of the commend looks perfect if I could get past the "Acess Denied" problem
LVL 85

Accepted Solution

oBdA earned 1600 total points
ID: 35460857
If /copy:DT works, then so should /copy:DAT; but any of the /copy:SOU options require that you have Full access on all source files and folders.
It depends on the file structure whether you need to copy NTFS permissions, or if the file data is enough; do you actually need the permissions? In general, the local(!) administrators group on the file server and System should have Full access on all folders.
Oh, and if you're running this on Vista or later, make sure you're running robocopy from an elevated prompt.

Author Comment

ID: 35461088

Thanks again. I'll try that...This one's still on XP.

Author Closing Comment

ID: 35483167

It worked very well. Will get the operator to test all files/permissions.

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

In a recent article here at Experts Exchange (http://www.experts-exchange.com/articles/18880/PaperPort-14-in-Windows-10-A-First-Look.html), I discussed my nine-month sandbox testing of the Windows 10 Technical Preview, specifically with respect to r…
Ever notice how you can't use a new drive in Windows without having Windows assigning a Disk Signature?  Ever have a signature collision problem (especially with Virtual Machines?)  This article is intended to help you understand what's going on and…
Windows 8 comes with a dramatically different user interface known as Metro. Notably missing from the new interface is a Start button and Start Menu. Many users do not like it, much preferring the interface of earlier versions — Windows 7, Windows X…
With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…

834 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