Using a Callback Function - ftplib

nitebirdz at sacredchaos.com nitebirdz at sacredchaos.com
Tue Aug 18 04:07:32 EDT 2009


On Mon, Aug 17, 2009 at 11:10:25AM -0700, seldan24 wrote:
> 
> I didn't even notice the higher level methods.  I changed the
> retrieval line to:
> 
> ftp.nlst("testfile*.txt")
> 
> This works great.  The result is even captured in an array.  I really
> have no idea what the difference between a LIST and NLST is within
> FTP.  Never delved that deep into it.  I did notice that an NLST will
> return a specific FTP code if a file doesn't exist, whereas a LIST
> doesn't.  So, I ended up using NLST as that'll generate an
> ftplib.error_perm exception.  Based on if the job cares if a file is
> not available or not (some do, some don't), I'll either exit, or
> continue on with the file loop.
> 

The following thread from a NetBSD mailing list may help clarify this
issue:

http://mail-index.netbsd.org/netbsd-users/2001/01/30/0016.html


NLST returns a machine-readable list of names, while LIST returns a
human-readable list.  Hene the presence of the FTP code in the case of
NLST.  




More information about the Python-list mailing list