Date as part of filename
Hello,
I am very new to WinSCP scripting. I need to be able to pull a file daily where the filename contains the date and therefore is different each day. I have created the following scripts that successfully pull a hard coded filename. After searching through the forum, I thought that using %TIMESTAMP#yyyymmdd% would allow for a dynamic date in the filename. I have this code commented out below. It does not work, though, and does not produce an error. Thanks in advance for assistance!
Command script:
REM Pull file from SFTP and place in directory
"F:\data tasks\winscp.com" /script="F:\data tasks\pull_file_from_daily_sftp.txt"
pull_file_from_daily_sftp.txt:
# Automatically abort script on errors
option batch continue
# Disable overwrite confirmations that conflict with the previous
option confirm off
# Connect
open XConnection
# Force binary mode transfer
option transfer binary
# Download
get -filemask="DAILY_20180410.zip" /current/daily/files/ "F:\Data Imports\daily\"
#get -filemask="DAILY_%TIMESTAMP#yyyymmdd%.zip" /current/daily/files/ "F:\Data Imports\daily\"
# Disconnect
close
exit
I am very new to WinSCP scripting. I need to be able to pull a file daily where the filename contains the date and therefore is different each day. I have created the following scripts that successfully pull a hard coded filename. After searching through the forum, I thought that using %TIMESTAMP#yyyymmdd% would allow for a dynamic date in the filename. I have this code commented out below. It does not work, though, and does not produce an error. Thanks in advance for assistance!
Command script:
REM Pull file from SFTP and place in directory
"F:\data tasks\winscp.com" /script="F:\data tasks\pull_file_from_daily_sftp.txt"
pull_file_from_daily_sftp.txt:
# Automatically abort script on errors
option batch continue
# Disable overwrite confirmations that conflict with the previous
option confirm off
# Connect
open XConnection
# Force binary mode transfer
option transfer binary
# Download
get -filemask="DAILY_20180410.zip" /current/daily/files/ "F:\Data Imports\daily\"
#get -filemask="DAILY_%TIMESTAMP#yyyymmdd%.zip" /current/daily/files/ "F:\Data Imports\daily\"
# Disconnect
close
exit