Robocopy ERROR 5 (0x00000005) Changing File Attributes: Access is denied

Posted: July 12, 2012 in Backup
Tags: , , ,

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:

  1. 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.
  2. 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:

http://ignitedsoul.com/2011/12/16/vm-backup-win-server-2008-r2-hyper-v/

http://ignitedsoul.com/2011/08/19/what-is-a-backup/

About these ads
Comments
  1. Phil Last says:

    thanks for the resolution.. was struck in between, this has helped me resolve the problem

  2. Edinaura says:

    this website is better than anyone else’s.

  3. [...] Comments Edinaura on Robocopy ERROR 5 (0×00000…Troubleshooting Tool… on Review of Active Directory in …Troubleshooting Tool… [...]

  4. Agate says:

    i enjoy your blog posts, thanks for posting this informative article.

  5. Marco says:

    Thank You .
    You saved my day !

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s