Topic "Current date in file name to download"

Author Message
nimmis
[View user's profile]

Joined: 2014-09-16
Posts: 8
Location: CA
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
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24530
Location: Prague, Czechia
See http://winscp.net/eng/docs/script_download_timestamped_filename

Also the next version will allow this more conveniently using %TIMESTAMP#YYMMDD% syntax.
http://winscp.net/tracker/show_bug.cgi?id=1223
I'm sending you a development build for testing.
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24530
Location: Prague, Czechia
The email didn't make it through. Is your email address on this forum valid?
Advertisements

You can post new topics in this forum






Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License