【问题标题】:cURL - Use cURL to ftp files and keep the original timestamp of filecURL - 使用 cURL 来 ftp 文件并保留文件的原始时间戳
【发布时间】:2011-04-05 19:36:42
【问题描述】:

我正在使用 curl 从 FTPS 站点下载一些文件。当我将文件从站点下载到我的机器时,zip 文件日期更改为下载时间和日期。我想保留 FTPS 服务器上的原始时间戳。 请告知如何执行此操作。如果你能提供 gr8 的例子,我是 curl 的新手。

谢谢

【问题讨论】:

    标签: file curl timestamp ftps


    【解决方案1】:

    关键是这个命令行选项:

       -R/--remote-time
              When  used,  this  will make libcurl attempt to figure out the
              timestamp of the remote file, and if that  is  available  make
              the local file get that same timestamp.
    

    ... 然后可以像这样使用:

    curl -R -O --ssl ftp://example.com/that/file/I/want.txt
    

    (--ssl 以前称为--ftp-ssl)

    【讨论】:

    • 我试过了,但什么也没发生。我的 zip 文件仍在使用新的下载时间下载。这就是我所做的: curl -R myftpsite "my destination path"
    • 好吧,我知道我做错了什么。如果我在没有指定目标的情况下执行 curl 命令,它会使用原始时间戳将 zip 文件保存在当前目录中。但是,如果我指定目标路径是在新时间下载 zip 文件时
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-01-11
    • 1970-01-01
    • 2014-06-29
    • 2016-05-07
    • 2015-06-09
    • 2015-03-18
    相关资源
    最近更新 更多