Thank you for being a valued part of the CNET community. As of December 1, 2020, the forums are in read-only format. In early 2021, CNET Forums will no longer be available. We are grateful for the participation and advice you have provided to one another over the years.

Thanks,

CNET Support

Resolved Question

problem with DOS xcopy

Dec 30, 2012 7:42PM PST

I use xcopy for backing up but the following bat file:

pause
xcopy C:\Temp\ G:\Temp\ /e/s/f/d/y
pause

gives me an 'invalid path' error.
Both the directories exist and there is one file in C:\Temp.
I would be grateful for any help here.

Discussion is locked

Penmere has chosen the best answer to their question. View answer

Best Answer

- Collapse -
Either remove ...
Dec 31, 2012 9:57AM PST

that trailing backslash or change it to:

xcopy C:\Temp\*.* G:\Temp\*.* /s/e/f/d/y

- Collapse -
Answer
Forgive me for asking
Dec 30, 2012 7:52PM PST

But files in the C:\Temp are not normally what someone would be looking to backup. That folder is usually used by the system to run downloads and other non-permanent files before they actually install, etc. Most cleanup software will delete the items from the temp folder, as it is considered trash. So, why copy that to another location?

- Collapse -
problem with DOS xcopy
Dec 30, 2012 8:16PM PST

Thanks for your reply. I tried to copy the Temp folder just as a test case. If I change the name of the folder I get the same error.

- Collapse -
Answer
(NT) Did you it without the trailing back slash?
Dec 31, 2012 2:18AM PST
- Collapse -
problem with DOS xcopy
Dec 31, 2012 6:11PM PST

Thanks for your reply - and it worked. I will be able now to get on and write my backup file . Thanks again.

- Collapse -
Answer
problem with DOS xcopy
Dec 31, 2012 6:15PM PST

Thanks for your reply - both solutions worked. I will be able now to get on and write my backup file . Thanks again.