xcopy

J

John Garate

I'm using windows XP
I'm having trouble getting xcopy to work in a simple batch file. I'm trying
to copy the Document and Settings directory (and its subfolders)with the
following batch file:

@echo off
xcopy C:\Document and settings G:\ /S /E /I /Q

The batch file seems to run, but no directories or files appear on the G
drive.

1. Is the problem the long file name? Will xcopy accept the long file names?

2. Do I have to specify the source directory name on the target drive (G:)?
Won't xcopy automatically create the directory?
 
B

Bill Stenzel

I have the identical problem. The batch job does xcopy s:*.* to a local
drive from a network drive. Worked like a charm under SP1, but SP2 makes it
just hang.
 
R

RobertVA

Check your C: drive for a folder named "and". DOS commands use spaces for
seperators betwen fields XCOPY may think your source folder is merely
"C:\Document" and the destination directory is "and". Since you probably
don't have a "Documents" folder the command might be stopping in it's tracks
at that point. A space shouldn't act as a seperator inside quotation marks:
XCOPY "C:\Documents and Settings" G:\ /E /I /Q

The help function for Xcopy says that the /S flag instructs the comand to
NOT reproduce empty subfolders/subdirectories. The same help function says
that the /E flag instructs the command to reproduce empty
subfolders/subdirectories. That conflict might not be helping matters.

The /Q (quiet) flag probably silences error messages as well as the file
list. Omitting that flag may allow the computer to tell you why the files
aren't being copied. If after omitting the /Q flag the listing stops after
listing the folder name you may need to add "\*.*" (without the quotes) to
the source file name and "Documents and Settings" to the destination.

You don't mention the nature of volume G:. If it is optical media like a CD
R or CD RW you may need use a burning application to copy the data to the
removable media.
 
J

John Garate

There is no folder named and on the c drive. The combination of /s and /e
switches should make xcopy copy all folders, empty or not.

One thing: I have recently re-formated my c drive and re-loaded windows; I
also loaded SP-2 which I did not use before. I'm now trying to use batch
files that sucessfully ran on SP-1. Could SP-2 be causing the problem?

The G drive is a second hard drive. I have two physical hard drives. I use
the second one (G:) for backing up my work on the C drive.

Do you think xcopy can use file names that contains a space separator?
 
G

Guest

-----Original Message-----
Do you think xcopy can use file names that contains a
space separator?

I think you missed his main point. You didn't quote the
file name. That shouldn't have worked under any version
of Windows.
 
F

Frank

John Garate said:
There is no folder named and on the c drive. The combination of /s
and /e
switches should make xcopy copy all folders, empty or not.

One thing: I have recently re-formated my c drive and re-loaded
windows; I
also loaded SP-2 which I did not use before. I'm now trying to use
batch
files that sucessfully ran on SP-1. Could SP-2 be causing the
problem?

The G drive is a second hard drive. I have two physical hard drives.
I use
the second one (G:) for backing up my work on the C drive.

Do you think xcopy can use file names that contains a space
separator?

The simple way out of this dilemma would be to use Windows
Explorer....
copy > paste
copy to >
rgt clk drag and drop
 
B

Bill Stenzel

Problem with batch job was now waiting for response to allow overwriting a
file. I added /Y option to batch command line to suppress this request.
Didn't need it under SP1, so I guess they fixed a loophole.
 
A

Alex Nichol

John said:
@echo off
xcopy C:\Document and settings G:\ /S /E /I /Q

The batch file seems to run, but no directories or files appear on the G
drive.

1. Is the problem the long file name? Will xcopy accept the long file names?

Yes: You have to wrap it in quotes to hold it together at the space, as
it is it will be looking for C:\Documents and not finding it.

xcopy "C:\Document and settings" G:\ /S /E /I /Q

You may in any case have difficulty in trying to copy the whole of
Documents and settings; partly because of access rights to users other
than yourself; partly in trying to copy your ntuser.dat file; the
Current User part of the registry which is not accessible to open when
Windows is logged in to that user
 
J

John Garate

Yes, I could use windows explorer copy and paste. However, I'm trying to
automate the process so I can make backups easily.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top