【问题标题】:Tectia command line - download files from server based on uploaded/modified dateTectia 命令行 - 根据上传/修改日期从服务器下载文件
【发布时间】:2019-10-24 21:43:10
【问题描述】:

我的服务器机器有一个 Unix 操作系统。我可以使用 Tectia 的 scpg3 命令行将文件从我的 Unix 服务器下载到本地(Windows)机器。现在,我只想复制那些在特定日期上传(修改日期)的文件。

我在我的 VBScript 中使用以下 scpg3 命令从服务器文件夹下载文件。它正在复制所有文件,但现在我想复制特定日期的文件。

Set oFTPScriptFSO = CreateObject("Scripting.FileSystemObject")

ioFTPScriptShell.Run "%comspec% /c scpg3 " & sUsername & "@" & remoteServer & ":" & sRemotePath & " " & strDirectory, 1, TRUE

珍惜你的时间。

【问题讨论】:

    标签: command-line vbscript download sftp


    【解决方案1】:

    我不认为scpg3 可以做到这一点。

    如果您将scpg3 用于SFTP 协议,则可以改用WinSCP

    ioFTPScriptShell.Run "%comspec% /c winscp.com /command ""option batch abort""" _
      & " ""option confirm off""" _
      & " ""open sftp://" & sUsername & "@" & remoteServer & """" _
      & " ""get -filemask=*>=2013-04-23<2013-04-24 " & sRemotePath _
      & " " & strDirectory & """", 1, TRUE
    

    注意get 命令的-filemask=*&gt;=2013-04-23&lt;2013-04-24 开关。

    详情见:
    https://winscp.net/eng/docs/guide_automation
    https://winscp.net/eng/docs/file_mask#size_time

    或者,您可以考虑直接从 VBScript 中使用 WinSCP .NET/COM 库:
    https://winscp.net/eng/docs/library
    https://winscp.net/eng/docs/library_com_wsh

    (我是 WinSCP 的作者)

    【讨论】:

      猜你喜欢
      • 2014-10-22
      • 1970-01-01
      • 2020-01-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多