Search code examples
windowscmdxcopy

Using xcopy to copy multiple files/directories, some of which have spaces


I'm trying to use xcopy to copy over several files and directories onto an external hard drive. The following command works fine...

xcopy d:\location\folder /e 

... except it's not copying over any files/directories withing d:/location/folder that have spaces. I understand that Windows requires file names with spaces need to be enclosed in quotes, but what do I do if I'm trying to do a huge recursive copy where there may be several files or folders with spaces in the name?


Solution

  • Use quotes:

    xcopy "d:\location\folder" /e