cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: Create empty files with timestamp

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Mon, 27 May 2002 23:53:19 +0200 (MET DST)

On Mon, 27 May 2002 renaud_chaillat_at_netcourrier.com wrote:

> We have a need here at work, to create local files even when the remote ftp
> file is empty (like other ftp clients). This is useful when associated with
> -R to keep the timestamp.
>
> We can more or less simulate it with retrieving filelist first and make a
> touch with the date when getting error code 19, but having curl create the
> file just like it is on the remote ftp server would be far better.

Hm. I think the error 19 when getting a file with size 0 bytes is bad. It
shouldn't be an error at all. We should fix this.

However, just fixing the error 19 will not make an empty file get created as
files are created by the client code only when the first chunk of data is
retrieved and as no data is received, no file will be created.

It would need a new option, as it would alter existing behavior.

Would you be able to provide a patch for something like this?

> On a side note, is there a way to get all the files in a ftp directory
> without getting the list first and iterating ?

There's no such way built into the curl command line tool at this time, no.
You could easily use libcurl to do it. Possibly by extending curl.

-- 
    Daniel Stenberg -- curl groks URLs -- http://curl.haxx.se/
_______________________________________________________________
Don't miss the 2002 Sprint PCS Application Developer's Conference
August 25-28 in Las Vegas -- http://devcon.sprintpcs.com/adp/index.cfm
Received on 2002-05-27