Using xcopy to copy multiple files/directories, some of which have spaces
Solution 1
Use quotes:
xcopy "d:\location\folder" /e
Solution 2
You should use quotes the following way:
xcopy "d:location\folder\anotherfolder\folder with spaces"
Note the unit letter and the colon go outside the quotes and no \
at the beginning either.
Related videos on Youtube
MT3
Experienced senior web developer focusing on digital development and management for high-profile, global projects leveraging modern technologies. I work very closely with technical architects, project managers, strategists, and creatives to scope projects, provide architectural decisions, and help with project planning and resourcing. In my role I also provide mentorship to the web development team and help evaluate new technologies that can solve development challenges.
Updated on July 09, 2022Comments
-
MT3 almost 2 years
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?
-
MT3 about 13 yearsHmm, I tried that, but still the same thing. It doesn't copy folders within that directory that have spaces. For example: [d:\location\folder\anotherfolder\folder with spaces]