Folder Names with Spaces in XCOPY doesn't work?

user1739467 picture user1739467 · Oct 13, 2012 · Viewed 25.5k times · Source

Working on a batch script that backs up various important folders on my PC, I have ran into a problem. I can't seem to copy folders that have a space in their name. If there is a sub-folder that has a space and it's parent doesn't, It works perfectly fine. I also seem to be having a problem where I have FULL permission to 'My Documents' folder, but XCOPY won't copy saying 'Access Denied'. Any help is very much appreciated.

Answer

Robert Harvey picture Robert Harvey · Oct 13, 2012

Surround your source specification with quotation marks, as in

xcopy "c:\my documents\some folder\*.*" ...