本文介绍了使用 WinSCP 在 Windows 上安排自动 FTP 上传的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

让我先声明一下,我从未在 WinSCP 的 UI 上执行过脚本.

我的服务器上有一个程序可以生成一个文本文件,我想将其发送到我们组织的共享驱动器.在浏览互联网时,我遇到了一些解决方案,例如下面的代码.(出于明显的原因,凭据已被排除)

选项批量中止选项确认关闭打开 ftp://user:pass@server同步本地 U:\DO Unitization\Team Member Folders\xxxxxxxx出口

然后将其保存为 .txt (abc.txt)

然后手动执行为winscp.com/script=abc.txt

这不是我想要的,认为整个目的是自动化.此外,实际上只需要发送一个文件,而不是目录中的所有文件.正如我上面所说,我在这方面缺乏知识,因此对于任何误解,我深表歉意.

谢谢,约书亚·阿维布赫

解决方案

首先,请参阅 WinSCP 指南自动将文件传输到 FTP 服务器.

使用 WinSCP 将文件上传到 FTP 服务器的简单批处理文件 (upload.bat) 如下所示:

winscp.com/log=c:\path\ftp.log/command ^打开 ftp://user:[email protected]/"^"put ""U:\DO Unitization\Team Member Folders\xxxxxxxx\file.txt"" ""/remote/path/""" ^出口"

您可以拥有 WinSCP GUI 生成的批处理文件.>

对于调度,只需使用 Windows 调度程序.
有关详细信息,请参阅另一份 WinSCP 计划文件传输到 FTP 服务器的指南.

下载类似:如何在 Windows 上安排自动 FTP 下载?

Let me preface this with a disclaimer, I have never executed scripts on the UI of WinSCP.

I have a program on our server that generates a text file that I want to be sent to our organization's shared drive. While looking through the internet I came across a few solutions, such as the code below. (Credentials have been left out for obvious reasons)

option batch abort
option confirm off
open ftp://user:pass@server
synchronize local U:\DO Unitization\Team Member Folders\xxxxxxxx
exit

This is then saved as a .txt (abc.txt)

Then executed manually as winscp.com /script=abc.txt

This is not what I want, seeing as thought the whole purpose was to automate this. Also, only one file actually needs to be sent, not everything in the directory. As I said above, my knowledge is lacking in this area so I apologize for any miscommunication.

Thank you,Joshua Averbuch

解决方案

For a start, see WinSCP guide to automating file transfers to FTP server.

A simple batch file (upload.bat) to upload a file to FTP server with WinSCP looks like:

winscp.com /log=c:\path\ftp.log /command ^
    "open ftp://user:[email protected]/" ^
    "put ""U:\DO Unitization\Team Member Folders\xxxxxxxx\file.txt"" ""/remote/path/""" ^
    "exit"

You can have the batch file generated by WinSCP GUI for you.


For scheduling, simply use the Windows Scheduler.
For details see another WinSCP guide to scheduling file transfers to FTP server.


Similarly for a download: How to schedule an automatic FTP download on Windows?

这篇关于使用 WinSCP 在 Windows 上安排自动 FTP 上传的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-10 06:35