Post a reply

Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)


Topic review


Re: Script help - multiple "get" statements

Please attach a full log file showing the problem (using the latest version of WinSCP).

To generate log file, use /log=path_to_log_file command-line argument. Submit the log with your post as an attachment. Note that passwords and passphrases not stored in the log. You may want to remove other data you consider sensitive though, such as host names, IP addresses, account names or file names (unless they are relevant to the problem). If you do not want to post the log publicly, you can mark the attachment as private.

Script help - multiple "get" statements

I'm trying to automate a process of getting and deleting files from the SFTP server. My issue is that when it gets to the first "get" statement that doesn't have files in the directory, it fails the entire process.

I tried with this line both in the script and not in the script since that is supposed to be the default: option failonnomatch off

I need the script to pull anything in the folder, if nothing move to the next get statement and not fail.

Batch file: /script=E:\test\winscp\eltsftp.txt


# Automatically abort script on errors
#option batch abort
# Disable overwrite confirmations that conflict with the previous
option confirm off
option failonnomatch off

#Connect to SFTP Server

open s

#Get and delete the customer data files ready for processing on ELT server.
#get -delete /test/upload/currencymaster/*.* E:\ABC\123\INCOMING_FILES\CURRENCYMASTER\
#get -delete /test/upload/customermaster/* get -delete /test/upload/ E:\ABC\123\INCOMING_FILES\CUSTOMERMASTER\
get -delete /test/upload/empmaster/*.* E:\ABC\123\INCOMING_FILES\EMPMASTER\
#get -delete /test/upload/registermaster/* E:\ABC\123\INCOMING_FILES\REGISTERMASTER\
get -delete /test/upload/skumaster/*.* E:\ABC\123\INCOMING_FILES\SKUMASTER\
#get -delete /test/upload/staging/*.* E:\ABC\123\INCOMING_FILES\STAGING\
get -delete /test/upload/storemaster/*.* E:\ABC\123\INCOMING_FILES\STOREMASTER\
#get -delete /test/upload/suppmaster/*.* E:\ABC\123\INCOMING_FILES\SUPPMASTER\
get -delete /test/upload/tloga_1/*.* E:\ABC\123\INCOMING_FILES\TLOGA_1\
#get -delete /test/upload/tlogb_1/* E:\ABC\123\INCOMING_FILES\TLOGB_1\

#Disconnect from SFTP server
#Exit the Winscp application