Page 1 of 1

CURL. How to check if remote file is newer without download

Posted: 05 Jul 2014 09:55
by Dragokas
Hi !

I use this code for downloading file if it is newer than local.

Code: Select all

curl.exe -# -z file -o file http://example.com/file


How can I do the same without downloading it ?

I read this manual: http://curl.haxx.se/docs/manual.html
but do not find anything helpful.

Thank's for your answers.

Re: CURL. How to check if remote file is newer without downl

Posted: 05 Jul 2014 18:31
by ShadowThief
I'm confused about what you want to do. Are you just trying to compare the age of a local file to the age of a remote file?

Re: CURL. How to check if remote file is newer without downl

Posted: 06 Jul 2014 06:59
by Dragokas
Yes. Why did you confused?

Re: CURL. How to check if remote file is newer without downl

Posted: 06 Jul 2014 07:20
by Dragokas
I can do it with comparing line "Last-Modified" of header with a local file.
But it is too complex way.

Code: Select all

curl "http://example/file" --head


HTTP/1.1 200 OK
Server: nginx/42
Date: Sun, 06 Jul 2014 13:18:00 GMT
Content-Type: application/octet-stream
Content-Length: 151734680
Last-Modified: Sun, 06 Jul 2014 11:59:27 GMT
Connection: keep-alive
Accept-Ranges: bytes