Robocopy Parameters

Posted on 2011-04-25
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
    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 82

    Expert Comment

    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
    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 .....

    Author Comment

    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


    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 82

    Accepted Solution

    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


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

    Author Closing Comment


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

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Find Ransomware Secrets With All-Source Analysis

    Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

    The password reset disk is often mentioned as the best solution to deal with the lost Windows password problem. In Windows 2008, 7, Vista and XP, a password reset disk can be easily created. But besides Windows 7/Vista/XP, Windows Server 2008 and ot…
    I don't know if many of you have made the great mistake of using the Cisco Thin Client model with the management software VXC. If you have then you are probably more then familiar with the incredibly clunky interface, the numerous work arounds, and …
    This video Micro Tutorial explains how to clone a hard drive using a commercial software product for Windows systems called Casper from Future Systems Solutions (FSS). Cloning makes an exact, complete copy of one hard disk drive (HDD) onto another d…
    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…

    759 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

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now