使用 WinSCP 在 Windows 安排自动 FTP 上传
Schedule an automatic FTP upload on Windows with WinSCP
让我先声明一下,我从未在 WinSCP 的 UI 上执行过脚本。
我的服务器上有一个程序可以生成一个文本文件,我想将该文件发送到我们组织的共享驱动器。在浏览互联网时,我遇到了一些解决方案,例如下面的代码。 (由于显而易见的原因,凭证已被遗漏)
option batch abort
option confirm off
open ftp://user:pass@server
synchronize local U:\DO Unitization\Team Member Folders\xxxxxxxx
exit
然后保存为 .txt
(abc.txt
)
然后手动执行为winscp.com /script=abc.txt
这不是我想要的,因为我认为整个目的是将其自动化。此外,实际上只需要发送一个文件,而不是目录中的所有文件。正如我上面所说,我在这方面缺乏知识,所以对于任何沟通不畅,我深表歉意。
谢谢,
约书亚·艾弗布赫
首先,请参阅 WinSCP guide to automating file transfers to FTP server。
使用 WinSCP 将文件上传到 FTP 服务器的简单批处理文件 (upload.bat
) 如下所示:
winscp.com /log=c:\path\ftp.log /command ^
"open ftp://user:password@example.com/" ^
"put ""U:\DO Unitization\Team Member Folders\xxxxxxxx\file.txt"" ""/remote/path/""" ^
"exit"
你可以得到 batch file generated by WinSCP GUI 给你。
对于调度,只需使用 Windows 调度程序。
详情见另一个WinSCP guide to scheduling file transfers to FTP server.
同样适用于下载:How to schedule an automatic FTP download on Windows?
让我先声明一下,我从未在 WinSCP 的 UI 上执行过脚本。
我的服务器上有一个程序可以生成一个文本文件,我想将该文件发送到我们组织的共享驱动器。在浏览互联网时,我遇到了一些解决方案,例如下面的代码。 (由于显而易见的原因,凭证已被遗漏)
option batch abort
option confirm off
open ftp://user:pass@server
synchronize local U:\DO Unitization\Team Member Folders\xxxxxxxx
exit
然后保存为 .txt
(abc.txt
)
然后手动执行为winscp.com /script=abc.txt
这不是我想要的,因为我认为整个目的是将其自动化。此外,实际上只需要发送一个文件,而不是目录中的所有文件。正如我上面所说,我在这方面缺乏知识,所以对于任何沟通不畅,我深表歉意。
谢谢, 约书亚·艾弗布赫
首先,请参阅 WinSCP guide to automating file transfers to FTP server。
使用 WinSCP 将文件上传到 FTP 服务器的简单批处理文件 (upload.bat
) 如下所示:
winscp.com /log=c:\path\ftp.log /command ^
"open ftp://user:password@example.com/" ^
"put ""U:\DO Unitization\Team Member Folders\xxxxxxxx\file.txt"" ""/remote/path/""" ^
"exit"
你可以得到 batch file generated by WinSCP GUI 给你。
对于调度,只需使用 Windows 调度程序。
详情见另一个WinSCP guide to scheduling file transfers to FTP server.
同样适用于下载:How to schedule an automatic FTP download on Windows?