Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

He script gurus!

Status
Not open for further replies.

cenn

IS-IT--Management
Jan 24, 2002
9
0
0
US
Does anyone have a dos script that will copy all modified and new files (only) from one location to another and e-mail if it fails?
 
use xcopy with the /d switch (type xcopy /? for more help on this switch)

and get something like for the sending of the email.

Not sure how you can get the email sent just when it fails so what you probably will have to do is add >file.txt onto the xcopy command and then send that file every day.
 
HI.

For the copy proccess, there are many options, including the built in XCOPY command.
Here are some other:
* ROBOCOPY from the NT resource kit.
* XXCOPY from:
And many other.

For the email proccess, you can check in the BAT file for the dos error level that can be set by the copy program (check each copy program for details), then use a SMTP mailer, like BLAT or my MAILIT util from here, or any other:

But I agree with the previous post, that it is better to send the mail each time on successful copy also and not only when fails. This way if the script does not run at all you'll still notice the absence of the email.

You can also add timing commands like this:
DATE /T >>LOGFILE.TXT
ECHO START COPY>>LOGFILE.TXT
TIME /T >>LOGFILE.TXT
program to copy files...
ECHO END COPY >>LOGFILE.TXT
TIME /T >>LOGFILE.TXT
program to email log files...

Bye
Yizhar Hurwitz
 
Wanted to thank everybody. the xcopy command seems to be doing the trick. Sill messing with the error notification but as long as the data is copying properly!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top