HiTek Software Home
Backup a file and receive email notification of success/failure
Date Updated  -  07/22/2007
User question: 
I need to backup (copy) a file, if it exists.  I need to send a command successful confirmation email when the backup is completed successfully and a failure notification when the backup fails.  (user is using a Windows 2000 system)

1) Run a copy command via a WinCommand task, using the windows NT
command shell (cmd.exe). This way the system exit code is returned correctly to Automize when the copy fails.  

In a WinCommand task:
For the commandline use: cmd.exe /c copy DHR.html DHRCopy.html
For the Working directory use: c:\temp

If the file exists and copy is successful, the WinCommand task will return with exit code = 0. If file does not exist, exit code = 1.

2) Create a Chain task with 3 steps
step 1 = WinCommand task from above
option = If exit code >0, go to step 3  (failure email)

step 2 = success email task
option = Chain always stops at this step

Step 3 = failure email task