get list of files

Fredrik Lundh fredrik at pythonware.com
Tue Feb 7 06:36:22 EST 2006


"eels" wrote:

> I want to get a listing of my files at web server with ftp. I wantn 't
> download the files.
> With yyy = ftp.retrlines('LIST') I get this listing at stdout, but I
> need this information at variable yyy.
> How can I resolve this problem?

as mentioned in the documentation, you need to provide a callback if
you want to collect the data from a retr operation.

   yyy = []
   ftp.retrlines("LIST", yyy.append)

should do the trick.

(also see the dir and nlst methods)

</F>






More information about the Python-list mailing list