2011-05-18 197 views

回答

0

此功能不内置,我知道的任何客户端,或为此事甚至FTP协议。

一个模仿此功能的客户端是Cyberduck,它具有“同步”功能,允许您使用时间戳上传到FTP服务器的同步文件夹的任何更改。

1

下面是我通过docs会后想出了一个教程:

  1. 下载并安装WinSCP并运行它
  2. 连接到服务器
  3. 转到菜单>会话>服务器/协议信息
  4. 复制 “Server host key指纹”(ssh-rsa 2048 xx:xx:xx:xx..."

现在创建一个名为upload.txt文件,添加以下内容(根据需要修改):

# Connect 
open sftp://user:[email protected]/ -hostkey="ssh-rsa 2048 xx:xx:xx:xx:xx:xx:xx:xx..." 
# Change remote directory 
cd /home/user/public 
# Download file to the local directory d: 
get robots.txt d:\ 
# Upload file to current working directory 
put d:\examplefile.txt 
# Disconnect 
close 
# Exit WinSCP 
exit 

接下来创建一个批处理文件run.bat用正确的路径:

"C:\Program Files (x86)\WinSCP\WinSCP.com" /ini=nul /script="C:\folder-with-uploadfile\upload.txt" 
pause 

运行该批处理文件。

检查检查文件robots.txt是否已下载到文件夹D:并且examplefile.txt位于服务器上的示例文件夹中。

在多台服务器的情况下:https://winscp.net/eng/docs/script_upload_multiple_servers


PS:我的FileZilla的长期用户,但2018年2月,他们没有这个功能呢。所以为WinSCP +1。

+1

+1虽然您最好使用'winscp.com'而不是'winscp.exe',以便您可以在控制台窗口中看到进度(和错误)。 – 2018-02-15 07:45:36

+1

伟大的提示。发布更新。并且:您创建的令人敬畏的软件。脚本将节省数小时的时间。 – 2018-02-15 07:53:30