Xcopy does not copy to right folder

January 7, 2010 at 16:22:51
Specs: Windows XP, 3 GHz / 1919 MB
The following XCOPY command which is run from C:\scripts copies the files, in their respective folders, to C:\scripts instead of C:\backups, where I want them.
I can't find the problem, can you?

xcopy /e /y "C:\Documents and Settings\William\Application Data\Thunderbird\Profiles\at3edgog.default\Mail\*.*"
"C:\backups\Documents and Settings\William\Application Data\Thunderbird\Profiles\at3edgog.default\Mail\*.*"

William Lockie


See More: Xcopy does not copy to right folder

Report •

#1
January 7, 2010 at 18:29:20
Just a quick idea before I hit the sack (UK time zone).

Try leaving off \*.* at the very end of the line, keeping the final quote. That is:

.....at3edgog.default\Mail"

Keep the first *.* intact.

Don't hold your breath tho because, like you, I can't see why the files/folders end up in C:\scripts

some other bloke...


Report •

#2
January 7, 2010 at 18:36:16
Shouldn't it be:

XCOPY source [destination] [options]

xcopy "C:\Documents and Settings\William\Application Data\Thunderbird\Profiles\at3edgog.default\Mail\*.*"
"C:\backups\Documents and Settings\William\Application Data\Thunderbird\Profiles\at3edgog.default\Mail\*.*" /e /y

MIKE

http://www.skeptic.com/


Report •

#3
January 7, 2010 at 18:44:10
You don't need *.* in either place.

xcopy "src" "dest\" /s/r/h/y/v/d


=====================================
Helping others achieve escape felicity

M2


Report •

Related Solutions

#4
January 7, 2010 at 18:47:26
Mike is right....the switches go on the end.

I am wondering if the destination dirs exist as well or do they still need to be made


Report •

#5
January 7, 2010 at 18:53:33
The switches can go after xcopy and before src. As in :

C:\temp\-\d10\gtest\tok\y\z>xcopy /s/d *.txt d:\test\
C:RENJPG.TXT
C:av\RAV.TXT
2 File(s) copied


=====================================
Helping others achieve escape felicity

M2


Report •

#6
January 7, 2010 at 19:09:42
I followed all the suggestions. The script would not even run. Went back to the original , it runs but the folders are placed in C:\scripts as before. And no, the folders do not exist in C:\backup. However, this is the only line of the script I am having trouble with. All other lines create the required folders and work fine with the same organization as the line in question. I am now going to place the folders in C:\backups manually and see if that makes a difference.
Bill

William Lockie


Report •

#7
January 7, 2010 at 19:35:32
Even if the folder structure is created manually in D:\backups it doesn't copy to them. I caught and changed an error in the destination script. Had C:\backups instead of D:\backups. Didn't make any difference though.

William Lockie


Report •

#8
January 7, 2010 at 19:42:53
Hmm, one way to debug a bat.....no pun intended, is to put a pause command in. This stops the bat until you press a key and you can see what it is doing or any error messages.


Report •

#9
January 7, 2010 at 19:52:33
I'll do that. For now it's bedtime.

William Lockie


Report •

#10
January 8, 2010 at 06:17:13
However, this is the only line of the script I am having trouble with.

What else is going on in the script? Something before or after the subject line may be effecting its execution.

MIKE

http://www.skeptic.com/


Report •

#11
January 8, 2010 at 08:35:19
Here's the entire script.

Xcopy /E /Y "c:\program files\microsoft visual studio\vfp98\memship\*.*" "c:\backups\mvfp98\memship\*.*"
xcopy /e /y "c:\Documents and Settings\William\My Documents\My RoboForm Data\*.*" "c:\Backups\My RoboForm Data\*.*"
xcopy /e /y "c:\Corel\Suite8\Shared\Address\*.*" "c:\backups\Corel\Suite8/Shared/Address\*.*"
xcopy /e /y "c:\Program Files\Calendar Creator 7.0\William.*" "c:\backups\Calendar Creator 7.0\William.*"
xcopy /e /y "c:\Corel\Suite8\Programs\*.lab" "c:\backups\Corel\Labels\*.*"
xcopy /e /y "c:\Corel\Suite8\Template\Custom WP Templates\wp8us.*" "c:\backups\Corel\Template\*.*"
xcopy /e /y "c:\Program Files\1trades\*.*" "c:\backups\1trades\*.*"
xcopy /e /y "C:\Documents and Settings\William\Desktop\*.*" "C:\backups\Documents and Settings\William\Desktop\*.*"
xcopy /e /y "C:\Documents and Settings\All Users\Desktop\*.*" "C:\backups\Documents and Settings\All Users\Desktop\*.*"

xcopy /e /y "C:\Documents and Settings\William\Application Data\Thunderbird\Profiles\at3edgog.default\Mail\*.*"
"C:\backups\email\*.*"

xcopy /e /y "C:\scripts\*.*" "C:\backups\scripts\*.*"
xcopy /e /y "c:\backups\*.*" "D:\backups\*.*"

I have put an extra line surrounding the offending command. Even with the destination reduced to a simple "C:\backups\email\*.*" the destination is still not found. But the destination IS found for the rest of the script.
What I am doing with the entire script is copying all of my recent calendar, addresses, emails, etc. data to a folder on my C: drive and then copying the backups folder to my extra 300Gb drive that I keep solely for image backups. This way I can restore any image but copy my most recent active data back where it can be used.
Bill

William Lockie


Report •

#12
January 8, 2010 at 08:57:20
William you have not listened to any of the feedback you received.

Drop the *.*
Put the switches at the end of the command


Report •

#13
January 8, 2010 at 09:54:13
I have listened. In fact a few posts ago I was told that it did not make any difference where I put the options. How do you explain how using *.* in the rest of the script works OK?

However, I have done it both ways. Changing the options to the end did not work and deleting the *.* didn't copy anything. The only one that works is the way I posted, albeit, to the C:\scripts folder instead of the folder in the destination portion of the XCOPY command.

William Lockie


Report •

#14
January 8, 2010 at 10:21:56
The only thing that I can figure is perhaps the path is in error, specifically the section that reads: \at3edgog.default

MIKE

http://www.skeptic.com/


Report •

#15
January 8, 2010 at 10:35:36
Some other things to try,
put a pause/echo "Finished first xcopy" after the first line, then another pause echo "finished second", etc, etc.

Put the offending lines at the bottom of the script and see what happens and/or put just the offending lines in their own bat and give it a go.

MIKE

http://www.skeptic.com/


Report •

#16
January 8, 2010 at 10:41:04
It does appear xcopy ignores the distination *.* [which is meaningless] and doesn't care where the switches are put after the command or at the end of the string.

I did a simple experiment

No c:\backup
ran the following command
c:\>xcopy "c:\documents and settings\*.*" c:\backup /e /y

First question asked was;
Does c:\backup specify a file name or directory name on the target. <f=file d=directory>?
answered "d" and file/folder copy completed

Made a folder backup
xcopy didn't ask the question of folder or directory.

Worked as expected.


Report •

#17
January 8, 2010 at 11:14:51
Mike,
I have checked and compared. It appears OK.

I did notice that the destination line was being treated as an internal command and the error message said so. That provided me a clue that I finally recognized. I removed all the spaces between the source and destination command and added JUST one space back in. Probably the extra space occurred from word wrap. Anyway running it one time it copied to the correct folder. Will try it again later.

William Lockie


Report •

Ask Question