cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Get the directory of remote machine

From: Dan Fandrich <dan_at_coneharvesters.com>
Date: Thu, 19 Sep 2013 21:24:17 +0200

On Thu, Sep 19, 2013 at 12:10:51PM -0700, Igor Korot wrote:
> Is it possible to get the directory of the remote machine?

For ftp, Yes. Just request a URL of the directory with a trailing backslash,
or use the CURLOPT_DIRLISTONLY option.

> What I'm looking for is the procedure to check for an updated file.
> I will connect to the remote server and get the directory sorted by date.

There is no standard way of requesting the list be sorted, and no standard
format for the directory listing, either. The only reliable way to do it is to
request a list of files only, then request the date for each of them in turn.
But, if you only care about certain servers, you can make some assumptions and
use nonstandard extensions to do it more quickly.

> If the last file's date and the file I have locally are from the same date -
> skip
> download. Otherwise get the newer file.
>
> Or maybe there is an easier process?

CURLOPT_TIMECONDITION

>>> Dan
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2013-09-19