How to copy directories with spaces in the name
There's no need to add space before closing quote if path doesn't contain trailing backslash, so following command should work:
robocopy "C:\Source Path" "C:\Destination Path" /option1 /option2...
But, following will not work:
robocopy "C:\Source Path\" "C:\Destination Path\" /option1 /option2...
This is due to the escaping issue that is described here:
The \ escape can cause problems with quoted directory paths that contain a trailing backslash because the closing quote " at the end of the line will be escaped \".
What's with separating My Documents
from C:\test-backup
? And why the quotes only around My Documents
?
I'm assuming it's a typo, try using robocopy C:\Users\Angie "C:\test-backup\My Documents" /B /E /R:0 /CREATE /NP /TEE /XJ /LOG+:"CompleteBackupLog.txt"
[Edit:] Since the syntax the documentation specifies (robocopy <Source> <Destination> [<File>[ ...]]
) says File, it might not work with Folders.
You'll have to userobocopy "C:\Users\Angie\My Documents" "C:\test-backup\My Documents" /B /E /R:0 /CREATE /NP /TEE /XJ /LOG+:"CompleteBackupLog.txt"
After some trial and error and observing the results (in other words, I hacked it), I got it to work.
Quotes ARE required to use a path name with spaces. The trick is there MUST be a space after the path names before the closing quote...like this...
robocopy "C:\Source Path " "C:\Destination Path " /option1 /option2...
This almost seems like a bug and certainly not very intuitive.
Todd K.