Re: 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.
You are missing
exit
command at the end of your script, so it never terminates.
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?
Yes, XML logging is the way to go. Though there's no way to find files that do not need synchronization.
Third and lastly, would be possible to execute an external command after each file has been synchronized? Ie., I would like to run anunzip
command if the file have been updated, and move the files to a separate directory.
Well, parse the XML log and call the external command for each synchronized file yourself.
For such a task, using WinSCP .NET assembly (e.g. from PowerShell) might be easier. See this example for a similar task:
Deleting remote files after successful remote to local synchronization