Windows: Ignore errors with Xcopy and RoboCopy

To copy entire directory structures as quickly as possible and ignore all disk errors (useful in data recovery) either of the following commands should work with robocopy being the quickest (if you’ve got Vista/7 or XP with the XP Resource Kit installed). Both commands use source -> destination path order.

xcopy /C/H/R/S/Y c:\ d:\

/C = Continues copying even if errors occur
/H = Copies hidden and system files also
/R = Overwrites read-only files
/S = Copies directories and subdirectories
/Y = Overwrites existing files without asking
robocopy c:\ d:\ /MIR /R:0 /W:0

/MIR = Mirror entire directory structure (can use /E instead)
/R:0 = 0 retries for read/write failures
/W:0 = 0 seconds between retries

13 Responses to Windows: Ignore errors with Xcopy and RoboCopy

  1. Dave says:

    Thanks Randy,

    A nice quick reference – much obliged.

    Dave

  2. User says:

    Be careful with option /MIR
    MIR can DELETE files as well as copy them !

    1. Rob Martin says:

      The /MIR by definition updates the backup to match the source. If files were deleted from the source, it deletes them from the backup.

  3. Lewis says:

    So with robocopy you just do 0 retries?

  4. ralph says:

    robocopy cannot ignore CRCs , certainly not even with those switches anyway.

    Here I did
    D:\VIDEO_TS>robocopy . c:\crp\dvd3 VTS_01_1.VOB /r:0 /w:0
    ….
    70.9% Newer 1023.9 m VTS_01_1.VOB
    2016/07/21 15:54:24 ERROR 23 (0x00000017) Copying File D:\VIDEO_TS\VTS_01_1.VOB
    Data error (cyclic redundancy check).

    ——————————————————————————

    Total Copied Skipped Mismatch FAILED Extras
    Dirs : 1 0 1 0 0 0
    Files : 1 0 0 0 1 0
    Bytes : 1023.96 m 0 0 0 1023.96 m 0
    Times : 0:10:11 0:10:11 0:00:00 0:00:00

    Ended : Thu Jul 21 15:54:24 2016

    D:\VIDEO_TS>

  5. Walkabout Tigger says:

    How do I get robocopy to ignore Access Denied errors?

    My command line is rather painful to read:

    C:\Windows\System32\Robocopy.EXE “\\LADT-3050D2J\e$” “E:\Migrated Data\Root\ByExtension” *.txt *.acl *.ade *.asd *.cnv *.doc *.dot *.grv *.h1q *.iaf *.maf *.mam *.maq *.mar *.mat *.maw *.mda *.mdb *.mde *.mdt *.mdw *.mpd *.mpp *.mpt *.mso *.oab *.obi *.oft *.olm *.one *.ops *.ost *.pip *.pot *.ppa *.pps *.ppt *.prf *.pst *.pub *.puz *.slk *.snp *.svd *.vdx *.vsd *.vss *.vst *.vsx *.vtx *.wbk *.wll *.xar *.xla *.xlb *.xlc *.xll *.xlm *.xls *.xlt *.xlw *.xsf *.xsn *.dic *.lex *.nk2 *.pdf *.rtf *.thmx *.ccda *.ccdb *.ccdb *.ccdc *.ccde *.ccdp *.ccdr *.ccdt *.ccdu *.crtx *.docm *.docx *.dotm *.dotx *.epkg *.pa *.pmsg *.potm *.potx *.ppam *.ppsm *.ppsx *.pptm *.pptx *.sldm *.sldx *.vsdx *.xl *.xlam *.xlsb *.xlsm *.xlsx *.xltm *.xltx *.xslb *.db *.dbf *.ldb *.mdb *.sdf *.sqlite *.bmp *.emf *.gif *.ico *.jpg *.png *.tif *.wmf *.dat *.kml *.kmz *.wav *.wmdb *.wpl *.icc *.properties *.zip *.msg *.nrl /S /EFSRAW /PF/XF *.tmp *cache* *akamai* *.lock *.ost /XD temp akamai cache content.ie* unified_cache_leveldb_leveldb2 “Application Data” “winsxs” “inf” “Assembly” “ServiceProfiles” “$Recycle.bin” /XJD /R:1 /W:10 /X /V /TS /FP /NP /LOG+:C:\Robocopy\20160816_085015.log /TEE

    but Robocopy is ignoring the /XJD switch and is essentially looping on an Access Denied error on a junction point.

    Any thoughts?

  6. Walkabout Tigger says:

    I found my error. The robocopy command is generated and execute programmatically. In the program, 2 static folders are being defined as excluded in two separate sections of the code. In the first of those sections, I neglected to provide a trailing space, so both folders were run together thusly:

    “Long Folder Name One””Long Folder Name Two” instead of “Long Folder Name One” “Long Folder Name Two”

    Adding the space in the program resolved the issue.

  7. Alan Sawyer says:

    I really only want robocopy to ignore not enough space errors, and just continue. In my case if it ignored out of space, then it would still have copied some of my files so space would get freed up.
    Hard to explain but if out of space could be ignored, that would work perfectly for me.

  8. Tim says:

    Good job! Thank you! I am doing a massive restore, that I just need to specify the top folder, but deep within the folder structure there were a few files I had no permissions to. They were killing it, and me. Attempted a couple things, with no luck. This did the trick and just rolled right over those files like a small speed bump. Excellent.

  9. As I am a person with a non technical background I just want software to get my job done in few clicks. And thus RoboCopy didn’t work for me at all. I faced allot of issues while copying file structure without copying the files in it that too with few permissions, but was ending up dealing with errors. I would suggest you to use GS RichCopy 360 Enterprise. It solved my issue. I hope this will solve your’s too.Here is the link to the software: http://www.gurusquad.com/GSRichCopy360Enterprise/GSRichCopy360Enterprise

  10. shreyash says:

    while searching for software which requires expertness is software related work to copy , i found the software RoboCopy which was quite easy but still required much of expertise in computer software. I encountered whole bunch of technical issues while copying file structure without copying the which i could not resolve on my own that too with few permissions, but was ending up dealing with errors which was not my cup cup tea to solve . the easiest software i came across from this site only that was GSRichCopy enterprise
    it was simple to use reliable and UI was the most user friendly i have ever used . this solved all my problems and i recommend it .hope this was helpful

  11. Randy says:

    Richcopy is very good. Even the free one.