I am wondering whether it is possible to execute an external command after each file has been synchronized using the synchronize feature in WinSCP? Ie., I would like to run an unzip command if the file has been updated, and move the files to a separate, unique directory. Currently, I am using 7-Zip batch scripts to unzip and move archives, but would like to simplify it within the WinSCP script itself, if possible.
Or, if there is a means to trigger the 7-Zip batch files if a new archive has been synced, that would also be great.
-> \Database 1
->Database.zip - No Sync Required
-> \Database 2
->Database2.zip - File Updated (File to be unzipped and moved)
-> \Database 3
->Database.zip3 - No Sync Required
The batch and script that I am currently using are as following:
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:
#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\"