This is an easy fix -- to have DOS intrepret spaces correctly, just enclose each of your paths in quotes,
Copy "S:\Example\Folders\*.*" "C:\Program Files\Folder Name\" /-y
=======================
Some other notes,
1) You may want to use 'xcopy'. It's a bit faster and has some more powerful options.
If you do use 'xcopy' then,
2) If the /destination/ directory doesn't yet exist, then add the "/i" switch. This tells xcopy to assume that the destination is a directory if you're copying more than one file, and it will create the destination dir for you.
3) Add the "/h" switch, if you want to get hidden and system files, too.
4) Add the "/c" switch. This will make the xcopy command continue to additional files/dirs even if it hits an error. This way, you'll get most stuff, then be able to figure out why it's not getting the rest.
5) Add the "/e" switch to copy all sub-directories, too, including empty ones. If you don't need to get empties, then just a "/s" will do.
6) If you want to get all the stuff under \source\, and you're using the "/e" or "/s" switch, then *.* is not required.
7) If you're going to do this more than once, and you want to make sure to overwrite read-only files in your destination, then add the "/r" switch.
8) If you don't want to see the "overwrite <>? (Yes,No, All)" prompt every time you run your batch, then change your "/-y" to a "/y"
===============
So, to copy the files
- including any directories or filenames with spaces in the names,
- and to create the initial destination directory,
- and get any hidden and system files,
- and to continue on errors,
- and get sub-directories including empty ones,
- and to overwrite read-only files,
- and to not have an overwrite prompt for existing files,
... your commandline could look like,
xcopy "s:\examples\folders" "c:\program files\folder name" /i /h /c /e /r /-y
(that's all on one line .. Answers wraps the text.)
2007-04-06 00:44:42
·
answer #1
·
answered by Kevin 7
·
3⤊
0⤋
Easiest way is probably to use the 8.3 format file folder name, ie in the case of program files it would be c:\progra~\ if memory serves
2007-04-05 20:21:22
·
answer #2
·
answered by y2bmj 4
·
0⤊
0⤋