Synchronize Script – Confirmation & External Commands
Hi there, I am looking to get a little help with my WinSCP synchronize batch script. First, I am looking to have the script output a notification, whether the script has successfully synchronized files or returned an errorlevel 1. As you can see in the screenshot provided below, I am presently not receiving a success or unsuccessful message at the end of my script.
I would like to use this as a first going, after which I would like to incorporate email confirmations. Which leads me to my second question – is it possible to output which of files have been either synchronized or do not require synchronization, and have the output sent by email? Would XML logging be the most simplistic means? Any examples anyone can provided?
Third and lastly, would be possible to execute an external command after each file has been synchronized? Ie., I would like to run an
Batch:
Script:
Thanks! :)
I would like to use this as a first going, after which I would like to incorporate email confirmations. Which leads me to my second question – is it possible to output which of files have been either synchronized or do not require synchronization, and have the output sent by email? Would XML logging be the most simplistic means? Any examples anyone can provided?
Third and lastly, would be possible to execute an external command after each file has been synchronized? Ie., I would like to run an
unzip
command if the file have been updated, and move the files to a separate directory.
Batch:
winscp.com /script="F:\Scripts\ScriptNotificationTest.txt" /log="F:\Scripts\FTPNotificationTestLog.txt" if errorlevel 1 goto error echo Synchronization Successful. goto end :error echo Synchronization Failed. end:
Script:
#Automatically abort script on errors option batch abort #Disable overwrite confirmations that conflict with the previous option confirm off #Connect to ******* server using existing login credentials open ******* #Synchronize database releases #Synchronize Test Zip synchronize local -criteria=time -resumesupport=on -filemask="TestZipFile.zip" "F:\*******\Databases\Stage\Test\" #Synchronize Test Zip 2 synchronize local -criteria=time -resumesupport=on -filemask="TestZipFile2.zip" "F:\*******\Databases\Stage\Test\"
Thanks! :)