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

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
Dragokas
Posts: 43
Joined: 30 Jul 2013 09:42
Location: Ukraine, USSR
Contact:

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

#1 Post by Dragokas » 05 Jul 2014 09:55

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.

ShadowThief
Expert
Posts: 1166
Joined: 06 Sep 2013 21:28
Location: Virginia, United States

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

#2 Post by ShadowThief » 05 Jul 2014 18:31

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?

Dragokas
Posts: 43
Joined: 30 Jul 2013 09:42
Location: Ukraine, USSR
Contact:

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

#3 Post by Dragokas » 06 Jul 2014 06:59

Yes. Why did you confused?

Dragokas
Posts: 43
Joined: 30 Jul 2013 09:42
Location: Ukraine, USSR
Contact:

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

#4 Post by Dragokas » 06 Jul 2014 07:20

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

Post Reply