cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: Modification dates of files downloaded from a sftp server

From: Jenkins, Peter (SLSA) <Jenkins.Peter_at_slsa.sa.gov.au>
Date: Mon, 15 Dec 2014 15:22:00 +1030

On Fri, 12 Dec 2014, Jenkins, Peter (SLSA) wrote:

I have been using curl to download files from a sftp server on AWS but I am
concerned that the files have their creation/modification dates/times
changed to the date and time of the download. This doesn't happen with other
servers.

Can I configure something so that the file date/time isn't changed?

On Fri, 12 Dec 2014 16:57:56 +0100 (CET), Daniel Stenberg wrote:

Using -R?

 -R, --remote-time

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

Thanks Daniel

I have read the man page so many times and I seemed to have always overlooked that option.

However, although I have tried with the -R option added to my curl command, and again with the --remote-time option, downloaded files still get the time of download.

Does this mean that curl is failing in its "attempt to figure out the timestamp of the remote file"?

When I look at the remote files in two different ftp clients, I see the expected times, such as
BRTM_PG01_101214.pdf 09/12/2014 11:13

If I get a "long listing" of the remote files with curl -Q pwd sftp://113.192.14.5//, I get
-rw-r--r-- 1 ftp ftp 5302532 Dec 9 00:43 BRTM_PG01_101214.pdf
(Here the time is UTC rather than the local Australian Central Summer Time displayed by my ftp clients, but it is the expected difference of 10h30m.)

So curl seems to be able to get the timestamp but not apply it on downloading.

What can I try now?

Peter

Peter Jenkins
Coordinator Digital Assets
State Library of South Australia

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-users
FAQ: http://curl.haxx.se/docs/faq.html
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2014-12-15