使用WinSCP从远程服务器下载名称为今天的文件
问题描述:
我想使用.bat和.txt文件下载远程目录中的每日文件
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?
谢谢
答
If you can rely on file timestamp, use file mask with time-constaint.
请参见基于WinSCP时间的文件下载.
如果必须依赖文件名,请使用 %TIMESTAMP%
语法:
If you have to rely on a file name, use the %TIMESTAMP%
syntax:
get filename_%TIMESTAMP#yyyymmdd%.txt
还考虑使用 WinSCP .NET程序集,而不是使用脚本.特别是,如果您知道,例如PowerShell.
Also consider using WinSCP .NET assembly, instead of scripting. Particularly, if you know, say, PowerShell.