xcopy question

Dell / DIMENSION 2400
November 29, 2009 at 14:44:31
Specs: Windows XP Home, 3.0 ghz / 2 gigs
I run a small batch file for when I
shutdown my XP, that copies info from
a folder on my C: drive, to a mirror
image D: drive.

Unfortunately it has stopped working
and I can't figure out why. Here is the
code:

C:
xcopy /h /y /d /s /q
C:\Progra~1\Qualcomm\*.*
D:\Progra~1\Qualcomm\

I have two folders off of my C: drive
called Programs, and Program Files.

The \Progra~1" is supposed to be
referring to my Program Files folder
and sub directory.


See More: xcopy question

Report •


#1
November 29, 2009 at 15:38:23
my guess would be the /D option with no date given. If backing up static files (programs and static data), the /D is better left off, since the static data should not change (and if it does change, better watch out! after all, why would you need to back up static material? it only needs to be saved once, and if it changes, you prob'ly don't want it anyway as it might have been corrupted)
If, as is more likely, backing up dynamic files, might be best to 1) check the dates of the files on D: drive, maybe they got set to the future, and of course verify your computer's date/time, 2) try xcopy with all your same options from the command-line, with the added option /L, and see what it gives you.

Report •

#2
November 29, 2009 at 16:00:31
My guess is you got snagged by the LFN grinch. Try:

xcopy "c:\Program Files\Qualcomm" /s/d/blabla


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

M2


Report •

#3
November 29, 2009 at 17:47:00
in my feeb opin, lfn is the bane of the windows world. I bet there is about 30 legions of microsoft (re)programmers who feel the same way. oh well... off subject anyway, apologies...

Report •

Related Solutions

#4
November 29, 2009 at 19:23:36
I tried several things, without any success.

I added the /L and no luck.

I removed the /d and no luck.

I changed the path to the full name of c:\program files\qualcomm and no
luck.

The dates on the D: drive are definately older than on the C: drive.

Let me ask you this....

If i have two folders that both start with Program ( program files and
programs ), how does xcopy know which folder i mean when i use progra~1


Report •

#5
November 29, 2009 at 19:27:09
Also, my apologies for not adding this.

It gives me an error message of " File not found - *.* "


Report •

#6
November 29, 2009 at 20:12:05
"It gives me an error message of " File not found - *.* ""

So are there any files in the source directory?


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

M2


Report •

#7
November 29, 2009 at 20:33:43
Yes, plenty of folders, and files with dates later than what are on the D: drive.

I have several other lines of code that are looking at other folders ( i use this
batch file as a shut down at night, so it copies the latest files to my mirror drive
D: ).

The other folders have their newer files updated, ( but not the ones in Program Files ), so I'm pretty sure it must be
the progra~1 But how to fix it, I'm not sure about.


Report •

#8
November 29, 2009 at 20:42:51
It's probably time to post your bat; otherwise we're just flailing.

Since you're trying to copy from "program files" some may be in use. But that should not give file not found.


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

M2


Report •

#9
November 29, 2009 at 22:00:24
Here is a copy of my "shutdown" batch file.

C:
xcopy /h /y /d /s /q C:\Program Files\Qualcomm\*.* D:\Program Files\Qualcomm\
xcopy /h /y /d /s /q C:\MyDocu~1\*.* D:\Mydocu~1\


Report •

#10
November 30, 2009 at 00:39:05
this line:

xcopy /h /y /d /s /q C:\Program Files\Qualcomm\*.* D:\Program

will surely NOT work without enclosing the paths in [double] quotes.


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

M2


Report •

#11
November 30, 2009 at 09:05:30
Mechanix2Go, I'm not quite sure what you mean by the double quotes.

Do you mean like this:

xcopy /h /y /d /s /q "C:\Program Files\Qualcomm\*.*" "D:\Program
Files\Qualcomm" ???


Report •

#12
November 30, 2009 at 10:44:53
xcopy "c:\Program Files\Qualcomm" /s/d/blabla

like this:
xcopy "c:\Program Files\Qualcomm" "D:\Program Files\Qualcomm" /s /d ...

or use the tilde (8dot3) version but making sure it's the right index (progra~1 and not progra~2 etc).
use DIR /X PROG*.* from root to verify that
"Program Files" does indeed equal "progra~1"
and verify the same on D:\
once verified, you can use the other way:
xcopy c:\progra~1\qualcomm d:\progra~1\qualcomm /s /d ...


Report •

#13
November 30, 2009 at 15:35:52
Thanks alot guys !

Report •

#14
December 3, 2009 at 05:02:24
Indeed, always use path (folder) names between double quotes, it also cannot harm if there are no whitespaces in them, so you can safely use them, only keep in mind you don't miss out one of a pair.

Don't use ~1 anymore ... the command CAN write a folder with that exact name, so, no as an abbreviation to the fullname, but actually that name. You really don't want to use that


Report •

#15
December 4, 2009 at 05:48:05
Don't use ~1 anymore ... the command CAN write a folder with that exact name, so, no as an abbreviation to the fullname, but actually that name. You really don't want to use that

Definitely, but this is missing the most important issue of all. 8dot3 file name aliases can be turned off completely! They are really only there for dos executable compatibility.

Double quotes can also avoid issues with & and () which were added to the command line as new "command characters" but are still legal file name characters, again a legacy from dos.....


Batch Variable how to


Report •

#16
March 5, 2014 at 19:00:08
Guys.....

THANK YOU, so much, for your quick and concise replies.

They were all appreciated!


Report •


Ask Question