xcopy batch

F

foxidrive

i have a scheduled batch file to run xcopy from a remote computer to local
computer
i use the /c flag - continue incase of errors - so locked file are not
copied but the batch confinues
the problem is that i don't get information of the errors that encountered
so I can try and copy the locked file later.

can someone recommend on a solution to that?

TIA.

xcopy command 2>file.log

It redirects STDERR into the log file, and I'm assuming details of locked
files will be printed to STDERR.
 
M

martin

i have a scheduled batch file to run xcopy from a remote computer to local
computer
i use the /c flag - continue incase of errors - so locked file are not
copied but the batch confinues
the problem is that i don't get information of the errors that encountered
so I can try and copy the locked file later.

can someone recommend on a solution to that?

TIA.
 
F

foxidrive

that's what i tried to do in the first place
to my surprise, the error information is not getting there.
i hope someone that works a lot with xcopy can suggest a solution.

:-(

Perhaps it's writing to STDOUT. This should get you the entire log.

xcopy command >file.log 2>&1
 
M

martin

that's what i tried to do in the first place
to my surprise, the error information is not getting there.
i hope someone that works a lot with xcopy can suggest a solution.

:-(
 
T

Todd Vargo

Perhaps it's writing to STDOUT. This should get you the entire log.

xcopy command >file.log 2>&1

Also, a separate copy command will be needed to copy file.log after xcopy
completes.
 
M

martin

what is the 2>&1 syntax means? is it documented somewhere?
what I need to know is:

1. which part is the file name to save?
2. what is the &?

TIA
 
J

Jerold Schulman

See tip 9206 » More on suppressing output to Stdout and Stderr.
AND link in the 'Tips & Tricks' at http://www.jsifaq.com

In the context of
xcopy command >file.log 2>&1
file.log records the output to stdout and stderr

1> pipes Stdout

2> pipes Stderr
defaults to 1>.

& means AND

what is the 2>&1 syntax means? is it documented somewhere?
what I need to know is:

1. which part is the file name to save?
2. what is the &?

TIA

Jerold Schulman
Windows Server MVP
JSI, Inc.
http://www.jsiinc.com
http://www.jsifaq.com
 
T

Timo Salmi

martin said:
what is the 2>&1 syntax means?

9) How can I suppress script error messages altogether?
163586 May 1 2006 ftp://garbo.uwasa.fi/pc/link/tscmd.zip
tscmd.zip Useful NT/2000/XP script tricks and tips, T.Salmi

All the best, Timo
 
S

Stefan Kanthak

Jerold Schulman said:
See tip 9206 » More on suppressing output to Stdout and Stderr.
AND link in the 'Tips & Tricks' at http://www.jsifaq.com

In the context of
xcopy command >file.log 2>&1
file.log records the output to stdout and stderr

Output redirection works generally in the context of the command
processor CMD.EXE.
1> pipes Stdout

2> pipes Stderr

Shouldn't that read "redirects" instead of "pipes"?
If not, how do you name "|" then?
& means AND

ARGH!
&<number> denotes the file descriptor <number> in the context of
IO redirection.

[needless fullquote removed]´

Stefan
 

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