curl-library
Re: Get the directory of remote machine
Date: Thu, 19 Sep 2013 12:54:47 -0700
Hi, Dan,
On Thu, Sep 19, 2013 at 12:24 PM, Dan Fandrich <dan_at_coneharvesters.com>wrote:
> 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
>
I googled a little and I guess this is what I will use as it is easier and
does not require
sorting the directory by date.
However, I didn't find any code example of setting this option.
Assuming I know the date of the local file, how do I set this option
properly?
Thank you.
> >>> Dan
> -------------------------------------------------------------------
> List admin: http://cool.haxx.se/list/listinfo/curl-library
> Etiquette: http://curl.haxx.se/mail/etiquette.html
>
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2013-09-19