I am baffled.

I've been running a robocopy script on my Windows XP box for several years without trouble. Recently, it has been failing occasionally with error 5 - access denied.

My script is a batch file with several instances of robocopy pointing at various folders. Here's an example of the one line that I know is failing (I think it's the only one, but it's first on the list so I'm not 100% sure) - all are identical except for the paths

robocopy "P:\Program Files" "z:\robobackup\Program Drive\Program Files" /purge /e /it /ts /fp /tee /w:1 /log:Z:\robolog_ProgramFiles.txt

(I install all my programs to the P drive instead of Windows default. I'd suspect a problem due to that, except that one of the files that fails is my own backup script, so I know it wasn't installed or have any weird permissions.)

I recently installed a new backup drive, but nothing else has changed. Here's what I did:

  1. Installed new drive, formatted it in XP's admin tool. Set drive letter to my old backup drive's letter (Z)
  2. Ran my script. It ran for over a day with no trouble at all, but I got tired of waiting for robocopy. Interrupted backup.
  3. I cloned my old backup drive to the new drive with SeaTools for DOS.

At this point, everything still seemed to work OK. Robocopy found all the same files on the old path and only copied changed files as it's always done. I was happy.

Here's the command I'm using:

robocopy "P:\Program Files" "z:\robobackup\Program Drive\Program Files" /purge /e /it /ts /fp /tee /w:1 /log:Z:\robolog_ProgramFiles.txt


I decided to add a line to the batch file to copy my network shared data folder (old win2K box) to my new backup drive.

I added the following as the first line to my script:

robocopy "\\calypso\shared folder" "z:\robobackup\calypso" /purge /e /it /ts /fp /tee /w:1 /log:Z:\robolog_Calypso.txt

This simply failed. I don't remember the error, but since I had never used robocopy to copy from a network, I figured I got the syntax wrong. I then mapped the folder to Y and tried again:

robocopy "Y:\shared folder" "z:\robobackup\calypso" /purge /e /it /ts /fp /tee /w:1 /log:Z:\robolog_Calypso.txt

I ran my script again and it copied the Y folder perfectly, but when it tried the P drive it started giving me the access denied errors. Now it will give errors seemingly at random, except that once a file errors out it will error out on that file every time**. As a test I changed the backup path ("Program Drive2" instead of "Program Drive") and even the drive to back up to to eliminate trouble with the new drive as a possibility. **When I changed the backup path the file that may have failed before no longer failed, but then it would fail on a different file.

If I remove the reference to the P drive it seems to work OK, but I can't be sure because I haven't edited any files on my data drives since starting this process.

I've read through every Robocopy Error 5 post I could find on Google and non have helped. I'm running it under an administrator-level account (same account as always) and I am the owner of all the files (it's possible that some of the files on the old Y2K network folder are owned by someone else with a Win7 box.)

Anybody have any brilliant ideas? I've been going crazy with this for three days.


* Updated Info * I downloaded a program called "Fastcopy" to see if that would work - it did not. So this is not limited to robocopy. I was able to copy the folder with XCOPY without any troubles.

All I can think of is that accessing that network drive changed some permission setting somehow, either of my admin user or of some of the files. I tried claiming the P:\Program Files folder (even through it already said I was the owner) - still having the problem.


You can use the /B (backup) switch to copy also those files that give access denied.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.