cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: How to download only new files from FTP server

From: Ankur Saxena <saxena84_at_yahoo.com>
Date: Wed, 19 Aug 2009 08:51:42 -0700 (PDT)

Ok. I am currently using wget to retrieve any newly added files from the ftp server (the --mirror option). But I want to switch to libcurl because I want to maintain a persistent connection (which will be more efficient). But now I am not sure if this whole process -- getting a list of files from the ftp server, parsing it and comparing it to the local files, and then downloading the files with different timestamp (or size) -- will help me save time over wget. Any comments? Thank you. ________________________________ From: Daniel Stenberg <daniel_at_haxx.se> To: libcurl development <curl-library_at_cool.haxx.se> Sent: Tuesday, August 18, 2009 5:11:05 AM Subject: Re: How to download only new files from FTP server On Mon, 17 Aug 2009, Ankur Saxena wrote: > I want to poll an FTP server at regular intervals, and download only newly added files. I looked at CURLOPT_FILETIME / curl_easy_setopt() and CURLINFO_FILETIME / curl_easy_getinfo() functionality, but I am not sure if this is the way to go. > > Could someone tell me how to achieve this? In short: it's a pain. libcurl offers the ability get a file conditionally based on its date over FTP (with CURLOPT_TIMECONDITION), but you need to specify exactly that file in the URL then. If you want to list a directory to find out which files that are new, you're really left to either to LIST or NLST and then parse the results in your app, but none of the directory listing outputs are standardized so you'd have to either make a very clever parser or you handicraft it specificly for the server(s) you know you'll work with. -- / daniel.haxx.se
Received on 2009-08-19