I'd like to copy the contents of D:\Documents (a folder on a local hard-drive) to Z:\Documents (a folder mapped to a NAS device).

xcopy.exe D:\Documents Z:\Documents /d /s /y

  • /d - copies all Source files that are newer than existing Destination files
  • /s - copies directories and subdirectories, unless they are empty
  • /y - suppresses prompting to confirm that you want to overwrite an existing destination file.

Fails saying:

Access denied

Unable to create directory - Z:\Documents

It's worth noting that Z:\Documents already does exist (and should exist, I want to copy files new/newly modified files into the existing folder).

If I reverse the source and destination the command works as expected, so I know both of the paths are correct.

If I open a command prompt and attempt to create a new directory in Z:\ or create a new file inside of Z:\Documents I'm able to without issue, so I know I have write-access to the Z:\ drive.

Can anyone tell me what I'm doing wrong?

  • 1
    xcopy.exe D:\Documents\* Z:\Documents /d /s /y /r add the /r flag. Also are you running it in an admin shell. Also, is the Z:\ drive ntfs or fat? I've also read a bunch about xcopy not liking hidden files, maybe mess w that attribute. – Narzard Aug 12 at 3:07

Your Answer

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

Browse other questions tagged or ask your own question.