1.

Solve : Batch copy across network with failure log?

Answer»

I'll just post this while I try to find the answer in the past POSTS...

I'm trying to copy some root folders off one networked drive and copy them onto a local drive on a server.
The kicker is I want it to run AUTOMATICALLY and inform me of any errors.
I found XXCopy, which will do this, but requires you to purchase a pro version or hit a button if it's on a networked drive, so it's paused until I hit a button. I get output to a log file that looks like this:

Code: [Select]\\SERVER2, a server (networked computer) is being accessed.

You have the XXCOPY Freeware version for a stand-alone computer.
If you access the remote disk on a regular basis, you may consider
acquiring a license for XXCOPY-PRO license (for 2 computers).
Press any key to continue . . .

-------------------------------------------------------------------------------
F:\055-244010.OLD\proj\sct10maj\lots\sct10maj.gcf 162
F:\055-244010.OLD\proj\sct10maj\zz\aaa.doc Copy failed
F:\055-244010.OLD\proj\sct10maj\zz\locale.dat 830
But when I use typical XCopy, it doesn't log that the file failed to copy, it puts in the Command window that called it so it looks like this:

Code: [Select]F:\055-244010.OLD\proj\sct10maj\lots\sct10maj.gcf
F:\055-244010.OLD\proj\sct10maj\zz\aaa.doc
F:\055-244010.OLD\proj\sct10maj\zz\locale.dat
F:\055-244010.OLD\proj\sct10maj\zz\Test.dat
868 File(s) copied
And the command window looks like this:
Code: [Select]C:\>testy.bat > c:\log.txt
Access denied
C:\(Note, I have a test file in there, aaa.doc that I don't have permissions to so I can test the errors)
So you can see how it doesn't tell me that aaa.doc had an error, just a list of errors in the command prompt - seems silly to me...

My question is two fold:

A) Is there a way to log XCopy's failures and which file it failed on?
B) Is there a way to emulate a keypress so I can get past XXCopy's complaints and still KEEP it logged properly so I can ensure the integrity of my backup?Quote

Is there a way to log XCopy's failures and which file it failed on?

Output usually consists of two output streams (1-STDOUT and 2-STDERR) which can be redirected together or separately. The default is the console.

xcopy parms >good.log 2>bad.log
each stream goes to separate files

OR

xcopy parms 2>bad.log
one stream to console; errors to file

OR

xcopy parms 2> both.log 1>&2
both streams to same output file


Quote
Is there a way to emulate a keypress so I can get past XXCopy's complaints and still keep it logged properly so I can ensure the integrity of my backup?

You might be able to pipe the enter key into xxcopy:

ECHO. | xxcopy parms

Not all programs can accept input from the pipe, but hey, you never know.

Good luck.

I think I have a similar request to the lines of this.

I want to output the copied files to a file, I can do that by typing >>%log% at the end of the command, but if there is a user prompt ....

Does \\Server\directory\Forms specify a file name
or directory name on the target
(F = file, D = directory)?

Is there a way to keep everything in the log and directory it to the console so the user can enter D for directory, or better yet of course have it automate. Dos is pretty much my only option at this time. If too off topic I will open a new topic. Thanks for your help. Now that I'm thinking about this a little more I think I figured it out. I can push everything to the log, then before the coping of the directory just make the directory first assuming I know its name which in this case I do.

Now for future reference if I didn't how could I handle this? While the literal from a prompt may end up in the log, there is still an interrupt pending on the console. PROVIDED you know the actual prompt, you can pump in the response:

echo D | xcopy source target >> log.txt

OR

echo F | xcopy source target >> log.txt

For programs that require multiple responses you can create a sequential response file and redirect the STDIN data stream:

xcopy source target 1>log.txt 0<resp.txt

The resp.txt file might contain:

D
Y

which will cover the situation when XCOPY first asks about files/directories and then requests your permission for overwrites.

Good luck.

Thank you for that, It worked. You can also try Syncback. I use it on my servers to backup files across machines.

http://www.2brightsparks.com/syncback/sbse-features.html

it works great and even creates a HTML log.



Discussion

No Comment Found