This error may occur if the reported folder is not accessible by the Service account on which the Backup is configured.
I use the below Robocopy command to backup my files to a network drive:
Robocopy “Source Folder” “Target Folder” /e /r:3 /w:1 /sec /mir /z /b /np /log:c:\Backup.log
As in the above syntaxes used below are the description of them:
/e: Copies subdirectories.
/r: Retry Option.
/w: Wait time.
/sec: Copies the security permission as same as the source folder.
/mir: Mirrors the directory tree. (Same as /e or /purge)
/z: Copies files in Restart mode.
/b: Copies files in Backup Mode.
/np: The progress of the copying operation will not be displayed. (% progress of each file)
/log: Creates a log file in the root directory so that you can have the details of copy.
For the error 5, it may be due to multiple reasons, include the below syntaxes to troubleshoot the error:
- You need to use the /FFT flag to assume FAT file times (2 second granularity). Although the target folder is Ntfs/Fat, these file systems also implement file times with 2 second granularity.
- You need to turn off the attribute copying. Robocopy uses the /COPY:DAT by default, which means to copy data, attributes and timestamp. You should turn off attribute copying by explicit setting /COPY:DT
This syntax should resolve the issue with Error 5 of Robocopy.
The Final Robocopy command would look like this:
Robocopy “Source Folder” “target Folder” /e /r:3 /w:1 /sec /mir /z /b /np /COPY:DT /FFT /log:c:\Backup.log
You may also get an issue where some of the automatic files generated by windows will not backup; these files may include Thumbs.db or Desktop.ini
You can exclude these file by adding the /XF syntax in the command.
You may also exclude some of the unwanted folder to be backed up from the command, for that you need to use /XD
Example command to exclude the unwanted files or folders:
Robocopy “Source Folder” “target Folder” /e /r:3 /w:1 /sec /mir /z /b /np /COPY:DT /FFT /XF *.ini thumbs.db /XD .trash /log:c:\Backup.log
Hope you have an error-free Backup 🙂
Other Posts related to backup:
https://ignitedsoul.com/2011/12/16/vm-backup-win-server-2008-r2-hyper-v/
thanks for the resolution.. was struck in between, this has helped me resolve the problem
this website is better than anyone else’s.
[…] Comments Edinaura on Robocopy ERROR 5 (0×00000…Troubleshooting Tool… on Review of Active Directory in …Troubleshooting Tool… […]
i enjoy your blog posts, thanks for posting this informative article.
[…] Robocopy Error 5 […]
Thank You .
You saved my day !
am copying files through RDP session \\tsclient\C\Folder as source….. i get access denied error for this when automated through task scheduler.
but works with out issues in powershell windows. Any help ??
You don’t want to exclude all .ini files, just desktop.ini
the /COPY:DT option did the trick for me
you saved my day, thank you