我们有一个数据库,每个星期一都会从客户端上传一个 Excel 文件.该文件始终具有相同的名称,因此如果我们忘记它,我们就会丢失它.有没有办法我们可以制作一个脚本来重命名脚本并给它日期或数字?
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?
我们现在使用 FileZilla 来获取文件.
We're using FileZilla to get the files now.
推荐答案FileZilla 不允许任何类型的自动化.
FileZilla does not allow any kind of automation.
您可以使用这个 WinSCP 脚本:
open ftp://user:password@host/ get "/path/sheet.xls" "c:archivesheet-%TIMESTAMP#yyyy-mm-dd%.xls" exit脚本连接到服务器,将工作表下载到本地存档,名称为 sheet-YYYY-MM-DD.xls.
The script connects to the server, downloads the sheet to a local archive under a name like sheet-YYYY-MM-DD.xls.
详情见:
- 自动将文件传输(或同步)到 FTP 服务器或 SFTP 服务器
- 下载文件到时间戳文件名
然后在 Windows 调度程序中创建一个任务以每周一运行 winscp.exe 并使用参数:
Then create a task in Windows scheduler to run the winscp.exe every Monday with arguments:
/script="c:path_to_scriptscript.txt" /log="c:path_to_scriptscript.log"日志记录(/log=...) 是可选的,但建议使用.
Logging (/log=...) is optional, but it's recommended.
有关详细信息,请参阅安排文件传输(或同步)到 FTP/SFTP 服务器.
For details, see Schedule file transfers (or synchronization) to FTP/SFTP server.
(我是 WinSCP 的作者)
更多推荐
将每周 Excel 文件下载安排为唯一名称
发布评论