To ignore errors and make Robocopy proceed without stopping, you can adjust the `/R` and `/W` switches in your command. The `/R` switch specifies the number of retries on failed copies, and the `/W` switch specifies the wait time between retries².
To force Robocopy to copy a file regardless of its condition, you can use the ‘/IS‘ and ‘/IT‘ switches in your command. The ‘/IS‘ switch includes the same files, and the ‘/IT‘ switch includes “tweaked” files 5.
Setting these to `B` will skip files that cause errors, and continue with the next files immediately.
Here’s how you can modify your command:
“`cmd
$Day = get-date -format 'yyyymmdd'
robocopy.exe "\\SAN\YourStore\Folder\" "D:\data" /M /TEE /DCOPY:T /COPY:DAT /E /R:0 /W:0 /MT:64 /XD ".TemporaryItems .Trashes $RECYCLE.BIN" /XD "System Volume Information" /XF ".apdisk" /XF ".DS_Store desktop.ini" /XF "Thumbs.db" /XF "*~$*" /XO /V /IS /IT /LOG:"C:\temp\$day-Robocopy_Log"
“`
This command will now ignore all errors and proceed with the copying process.
NOTE: The file exclusion switch has a known bug, so that is why each exclusion is specified individually. –Patrick@Burwell.tech
(1) Is there a way for Robocopy to ignore file copy errors?. https://answers.microsoft.com/en-us/windows/forum/all/is-there-a-way-for-robocopy-to-ignore-file-copy/d252ccce-e646-45a7-93c7-656e9f392dc3
(2) How to use Robocopy to quickly recover and skip files with errors …. https://pureinfotech.com/robocopy-recover-and-skip-files-with-errors-from-bad-hard-drive-in-windows/
(3) Ignore errors with Robocopy by using retries for read/write failures …. https://www.joe0.com/2017/10/23/ignore-errors-with-robocopy/
(4) Windows: Ignore errors with Xcopy and RoboCopy | Randy’s Blog https://djlab.com/2010/12/windows-ignore-errors-with-xcopy-and-robocopy/
(5) Copy defective and Tweaked files: https://stackoverflow.com/questions/40744335/how-do-i-force-robocopy-to-overwrite-files *
* While we do link to StackOverflow.com, be warned that these people are notoriously and will block/ban you for the smallest “infraction”, they are bad-tempered, and use no logic to their evaluations, so be aware and make no comments!
P.s. We cannot be responsible for content existence or the accuracy of what is linked