xcopy in nt command interpreter

  • Thread starter Thread starter Bluu
  • Start date Start date
B

Bluu

can anyone help out?
command interpreter

i am using the xcopy function to copy files from one
folder to another.
in some cases there will be 0 files to copy.
is there a way i can add a statement that will take me to
a certain label if the number of files copied is 0?
if the number is 1 or more the program can continue on to
the next line and keep doing it's thing.

thanx

if there is a newsgroup for this let me know i would love
to look through the faqs and quetions posted there.
 
can anyone help out?
command interpreter

i am using the xcopy function to copy files from one
folder to another.
in some cases there will be 0 files to copy.
is there a way i can add a statement that will take me to
a certain label if the number of files copied is 0?
if the number is 1 or more the program can continue on to
the next line and keep doing it's thing.

thanx

if there is a newsgroup for this let me know i would love
to look through the faqs and quetions posted there.

Bluu,

Try alt.msdos.batch.nt - they discuss scripting issues like yours.

Cheers,

Chuck
I hate spam - PLEASE get rid of the spam before emailing me!
Paranoia comes from experience - and is not necessarily a bad thing.
 
Bluu said:
can anyone help out?
command interpreter

i am using the xcopy function to copy files from one
folder to another.
in some cases there will be 0 files to copy.
is there a way i can add a statement that will take me to
a certain label if the number of files copied is 0?
if the number is 1 or more the program can continue on to
the next line and keep doing it's thing.

thanx

if there is a newsgroup for this let me know i would love
to look through the faqs and quetions posted there.

This is not a feature of xcopy.

Probably what you need to do is write a script in some language
(VBScript, Perl, or something) to do this level of logic steps.
 
Rob said:
This is not a feature of xcopy.

Probably what you need to do is write a script in some language
(VBScript, Perl, or something) to do this level of logic steps.

It may be possible using batch processing and if/then errorlevel returns
and line labels (something like "if errorlevel = (n) then goto (line
label)". I can't give specifics because I don't know what errorlevel
returns are available with xcopy. OP will need to look into that
themself, perhaps a web search on batch proccessing.

Steve
 
Steve said:
It may be possible using batch processing and if/then errorlevel returns
and line labels (something like "if errorlevel = (n) then goto (line
label)". I can't give specifics because I don't know what errorlevel
returns are available with xcopy. OP will need to look into that
themself, perhaps a web search on batch proccessing.

Steve

Yes, it *might* be possible, but key to success would be to have
documented errorlevel codes on xcopy, which far as I know are not
published. Could be figured out, I guess. While i thought of this,
chose not to recommend batch processing and instead focus OP's attention
on using a higher-level scripting language where this level of
control/logic is relatively trivial.

Also I would recommend OP look to see how to use robocopy (available
free from Microsoft) which is fully documented and is much more robust
and sophisticated. It has documented errorlevels, but not the ones the
OP is saying he/she wants. However, it could be that she/he could
achieve what they want with the right use of robocopy command strings.
 
What, you don't keep the Dos 6.22 help file handy. Anyway while below is from Dos (I believed you when you said it wasn't documented) it's also in XP's help. Find's exit codes are only in Dos's help


0 Files were copied without error.

1 No files were found to copy.

2 The user pressed CTRL+C to terminate XCOPY.

4 Initialization error occurred. There is not enough memory or disk space,
or you entered an invalid drive name or invalid syntax on the command
line.

5 Disk write error occurred.
 
David said:
What, you don't keep the Dos 6.22 help file handy. Anyway while below is from Dos (I believed you when you said it wasn't documented) it's also in XP's help. Find's exit codes are only in Dos's help


0 Files were copied without error.

1 No files were found to copy.

2 The user pressed CTRL+C to terminate XCOPY.

4 Initialization error occurred. There is not enough memory or disk space,
or you entered an invalid drive name or invalid syntax on the command
line.

5 Disk write error occurred.

Thanks ... I've now put these codes into my personal documentation!!

ps. I do have DOS manuals from 6.0 vintage but until you mentioned them
I forgot about them. I was looking in other more contemporary locations
and didn't find anything.
 
Well, I do have a two book set of MS-DOS Technical Reference and
Programmer's Reference Manuals, but they're at home :)

Steve
 
Rob said:
Yes, it *might* be possible, but key to success would be to have
documented errorlevel codes on xcopy, which far as I know are not
published. Could be figured out, I guess. While i thought of this,
chose not to recommend batch processing and instead focus OP's attention
on using a higher-level scripting language where this level of
control/logic is relatively trivial.

Certainly valid point there. Batch proccessing can be a challenge.
Also I would recommend OP look to see how to use robocopy (available
free from Microsoft) which is fully documented and is much more robust
and sophisticated. It has documented errorlevels, but not the ones the
OP is saying he/she wants. However, it could be that she/he could
achieve what they want with the right use of robocopy command strings.

I'm going to have to take a look at robocopy. Never heard of it before.
Thanks.

Steve
 
It's in Xcopy's help in Start - Help & Support..I know find's exit codes aren't but XCopy ae.
 
David said:
It's in Xcopy's help in Start - Help & Support..I know find's exit codes aren't but XCopy ae.

Cool. Thanks for pointing that out. I was looking at "help xcopy"
command. And guess when looked at the XP's help, didn't page down that
far. Thanks for the catch.
 

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

Back
Top