XCOPY "Access Denied" and "Unable to create directory"

Status
Not open for further replies.

phuz

Honorable
Sep 24, 2013
48
0
10,540
I have a batch file that runs to backup a bunch of work files on another computer. I use a "net use" command to map a drive during the copy process. This batch file worked great until I switched over to a NAS drive. The permissions are very loose in that I can read/write without authentication, but when running the XCOPY sequence, I get access denied on the files in the root directory and when it gets to the first directory, it says "Unable to create directory XXXX".

If I copy those same files/folders through explorer, it works fine.

The xcopy command looks like this:

xcopy from_folder Q:\ /D /E /H /R /K /Y
 
Solution
Hello,

hope this answer can still be good.. I had the same problem win Win 7, you need to remove the "Hidden" attribute of the file(s) so xcopy can copy over them.. I had to do a attrib -h xxxx.yyy file, xcopy, then attrib +h xxxx.yyy to get it to work..

Good luck

Forest
These switches have the following effects:

/E - Copies folders and subfolders, including empty ones.
/H - Copies hidden and system files also.
/K - Copies attributes. Typically, Xcopy resets read-only attributes.
/O - Copies file ownership and ACL information.
/X - Copies file audit settings (implies /O).
 


The sky is sometimes blue. Why are we posting obvious things Shaun? I know very well what all of the xcopy switches do. This is not an XCOPY issue, but clearly a windows/networking issue.
 
Hello,

hope this answer can still be good.. I had the same problem win Win 7, you need to remove the "Hidden" attribute of the file(s) so xcopy can copy over them.. I had to do a attrib -h xxxx.yyy file, xcopy, then attrib +h xxxx.yyy to get it to work..

Good luck

Forest
 
Solution
In my case the solution was to recreate the source directory and move the files into there,

I noticed that using the switches ( xcopy D:\fotos\*.* /e/r/c/i/d/y/s/H/m M:\foto\ ) some (new) directories were copied without any error..

I don't know why but it helped..
 
I actually switched to RBC replacing all dir was to much work...

robocopy D:\fotos\ M:\foto\ /E /XO /XC /R:2 /W:2 /FFT /COPY😀T

and its been running all evening....
 
Ahh why reinvent the wheel?
Using ROBOCOPY is much better and looks like its a native command.

well I tried robocopy /mir and IT DELETED ALL MY FILES IN DEST FOLDER without confirmation

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

just a heads up for the next person to fall into this trap

rip
 
Status
Not open for further replies.