[ftputil] Stat'ing a Whole Directory
Dan Milstein
danmil at comcast.net
Wed Jul 19 21:57:08 CEST 2006
FTPUtil Folk,
I've been using the lovely ftputil lib, and, basically, it's fab.
However, 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.
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.
-Dan Milstein
More information about the ftputil
mailing list