[ftputil] Stat'ing a Whole Directory

Stefan Schwarzer sschwarzer at sschwarzer.net
Fri Jul 21 01:38:59 CEST 2006


I just noticed that I had sent this mail to Dan in private though
it was intended for the list.

-------- Original Message --------
Subject: Re: [ftputil] Stat'ing a Whole Directory
Date: Thu, 20 Jul 2006 00:42:42 +0200
From: Stefan Schwarzer <sschwarzer at sschwarzer.net>
To: Dan Milstein <danmil at comcast.net>
References: <71478D44-887F-421A-BF84-B7E82B3D8D82 at comcast.net>

Hi Dan,

On 2006-07-19 21:57, Dan Milstein wrote:
> I've been using the lovely ftputil lib, and, basically, it's fab.

thanks :-)

> However,

aah, now ... ;-)

> for my app, I need to produce detailed directory listings
> for the files on the remote server.  With the current interface, that
> means getting the list of all files (one remote call), and then
> fetching that entire list over and over in order to stat each
> individual file (a remote call for every file).
>
> There's already a ticket for caching stat results, but what works
> better for me is to add a new call:
>
> host.statdir(path)
>
> (or host.lstatdir(path), if that makes more sense -- I'm not the most
> perfectly clear on how symbolic links interact with ftp).
>
> The call returns a list of stat results, making a single remote call
> and then parsing the entire list.  This gets around the need for
> caching (which I'd prefer to avoid, because of synchronization
> issues), and has very nice performance.

This is a good idea! Nonetheless I'm a bit hesitant to use it in
ftputil, because this is somewhat "low-level", compared with the
usual ftputil mindset.

I'm _very_ interested what the others on the list think!

> I've actually patched ftputil and ftp_stat with the necessary code to
> do this.  I'd be happy to send along patches for those files, or just
> include the code in an email.

_Please_ send the patch(es) to the mailing list(*), so anyone who
wants to try the code (and how its usage "feels") can do it. If
you can, make a single patch for all affected files. I'm not 100%
sure if the list accepts attachments. If your mail bounces,
please include the patch into the normal text and resend it.

(*) Before you post, think about whether you can and want to put
the code under the BSD license that ftputil uses. Strictly
speaking, this is only relevant for inclusion of the code into
ftputil but I also read the list, of course, and I wouldn't want
to accidently put code from my memory into ftputil which doesn't
belong there.

Best wishes
Stefan



More information about the ftputil mailing list