Solved xcopy - file not found?

July 23, 2011 at 09:40:33
Specs: Windows XP
ok, i have a folder named "FOLDER" which is located at c:\FOLDER
This folder contains another folder named "CONFIG" and a batch file "TEST.bat"

the TEST.bat has this code:

xcopy config C:\1/e/y/v/i/s

This code runs properly and it does what i want to do ( copy CONFIG files to C:\1 )
But from microsoft's website, it says that the syntax should be:

xcopy \config C:\1/e/y/v/i/s

This code produces an error:

C:\FOLDER>xcopy \config C:\1/e/y/v/i/s
File not found - config
0 File(s) copied

Press any key to continue . . .

Is there something wrong with my computer?
I don't know why i get error when I add "\" on the source.
I don't want to specify the full path c:\folder\config because i want a batch file that will work regardless of the path of the directory "FOLDER"

See More: xcopy - file not found?

Report •

July 23, 2011 at 10:29:26

No, I don't think there's anything wrong with your machine. According to the XP documentation located at:
you are attempting to specify file C:\FOLDER\config , instead of folder C:\FOLDER\config. By using the backslash, you're essentially telling it to look in the FOLDER directory for the config file, instead of the config folder.

Report •

July 23, 2011 at 10:51:52
ok, i'm confused :P

what i wanted to do is to copy the files within the directory CONFIG to C:\1 directory.

and microsoft has this example:

To copy the \Customer directory and all subdirectories to the directory \\Public\Address on network drive H:, retain the read-only attribute, and be prompted when a new file is created on H:, type:
xcopy \customer h:\public\address /s /e /k /p

-- it used a backslash.. but from my code,xcopy \config C:\1/e/y/v/i/s if i use a backslash, i get an error :(

Report •

July 23, 2011 at 11:41:44
✔ Best Answer
So, I recreated what you were trying to do and got the same error, with that in mind, I would just stick with what works. A different approach would be:

C:\folder\> xcopy config\*.* C:\1 .

But that still doesn't use the backslash.

After looking through both the MS-DOS User's Guide and MS-DOS encylopedia, you can, however, specify the command like this:

C:\folder\> xcopy \folder\config C:\1
C:\> xcopy \folder\config C:\1

Any of these will work.
(Same person, sorry, username troubles.)

Report •

Related Solutions

July 23, 2011 at 12:20:20
i was actually trying to create a batch file that copies the files from the CONFIG folder to C:\1 folder

I don't want to specify the full source path ( C:\FOLDER\CONFIG ) because the batch file will surely not work if I move the FOLDER to another location so i tried to use \CONFIG as source. But it seems it doesn't work :P

my directory and files is like this:

the destination is constant, which is C:/1

I'm just worried that the batch file won't work if I try to share the FOLDER directory to another computer and used the code xcopy config C:\1/e/y/v/i/s instead of xcopy \config C:\1/e/y/v/i/s

Report •

Ask Question