Schedule weekly Excel file download to an unique n

2019-02-15 19:58发布

问题:

We got a database where every Monday a Excel file gets uploaded from a client. The file is always the same name so if we forgot it we lost it. Is there a way how we can make a script that renames the script and gives it the date or a number?

We're using FileZilla to get the files now.

回答1:

FileZilla does not allow any kind of automation.


You can use this WinSCP script:

open ftp://user:password@host/
get "/path/sheet.xls" "c:\archive\sheet-%TIMESTAMP#yyyy-mm-dd%.xls"
exit

The script connects to the server, downloads the sheet to a local archive under a name like sheet-YYYY-MM-DD.xls.

For details see:

  • Automate file transfers (or synchronization) to FTP server or SFTP server
  • Downloading file to timestamped-filename

Then create a task in Windows scheduler to run the winscp.exe every Monday with arguments:

/script="c:\path_to_script\script.txt" /log="c:\path_to_script\script.log"

Logging (/log=...) is optional, but it's recommended.

For details, see Schedule file transfers (or synchronization) to FTP/SFTP server.

(I'm the author of WinSCP)