Post a reply

Options
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)

Options

Topic review

martin

Re: Current date in file name to download

The email didn't make it through. Is your email address on this forum valid?
nimmis

Current date in file name to download

I am trying to automate a process where we download a each day from an SFTP server and these files each have a name that changes according to the date. For example today, August 23, 2014, the file name would be dailyfile_140823.xlsx. I have looked through the documentation and could not find anything. Can someone either point me in the right direction as far as something i can pull an example from or provide some assistance? So far this is what my script looks like

# Automatically abort script on errors
option batch abort
# Disable overwrite confirmations that conflict with the previous
option confirm off
# Connect
open ftp://xyz:xyz@ftp.com:31110/ -explicittls
# Change remote directory
cd /xyz/Extracts/daily
# Download file to the local directory
#this is where I need to pass the file name xyz_yymmdd -how to do this?
get filename E:\sql\finance\extracts\DailyUPB.xlsx
# Disconnect
close
# Exit WinSCP
exit