cURL - 使用cURL来ftp文件并保留文件的原始时间戳

art*_*hur 9 curl timestamp file ftps

我使用curl从FTPS站点下载一些文件.当我将文件从站点下载到我的机器时,zip文件日期会更改为下载时间和日期.我想保留FTPS服务器上的原始时间戳.请告知如何做到这一点.如果你能提供gr8的例子我是新来的卷曲.

谢谢

Dan*_*erg 19

关键是这个命令行选项:

   -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.
Run Code Online (Sandbox Code Playgroud)

......然后可以像:

curl -R -O --ssl ftp://example.com/that/file/I/want.txt
Run Code Online (Sandbox Code Playgroud)

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

  • 好吧,我知道我做错了什么。如果我执行curl命令而不指定目的地,它将使用原始时间戳将zip文件保存在当前目录中。但如果我指定目标路径是在新时间下载 zip 文件时 (2认同)