0

I want to use .bat and .txt files to download a daily file I have off of a remote directory

The root of the file is always the same, but the date changes...daily

get filename_yyyymmdd.txt

How can I search and download the file with today's date?

Thanks

Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992
Rhodo
  • 1,234
  • 4
  • 19
  • 35

1 Answers1

2

If you can rely on file timestamp, use file mask with time-constaint.

See WinSCP time based file download.


If you have to rely on a file name, use the %TIMESTAMP% syntax:

get filename_%TIMESTAMP#yyyymmdd%.txt

Also consider using WinSCP .NET assembly, instead of scripting. Particularly, if you know, say, PowerShell.

Community
  • 1
  • 1
Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992