【问题标题】:How to copy new files from SFTP using WinSCP script如何使用 WinSCP 脚本从 SFTP 复制新文件
【发布时间】:2017-12-25 22:22:03
【问题描述】:

我只想使用 WinSCP 从一台 SFTP 服务器下载新文件。

假设,我今天在源和目标中有 10 个文件。
明天可能会向源添加一个新文件。在这种情况下,我只想将新文件复制到目标位置。

我正在使用以下脚本:

open sftp_connection
cd /path
option transfer binary
get "*.txt" localpath
close
exit

通过使用上述方法,我可以复制所有文件,但我只想要目标中不可用的新文件。

谢谢,
斯里克里希纳。

【问题讨论】:

    标签: sftp winscp


    【解决方案1】:

    最简单的解决方案是将-neweronly switch 添加到您的get command

    get -neweronly *.txt C:\local\path\*
    

    对于非常相似的结果,您也可以使用synchronize command

    synchronize local . C:\local\path -filemask=*.txt
    

    另请参阅 Downloading the most recent file 上的 WinSCP 文章。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2023-02-23
      • 2023-03-18
      • 1970-01-01
      • 2019-08-30
      • 1970-01-01
      • 2019-05-14
      • 2019-02-11
      • 1970-01-01
      相关资源
      最近更新 更多