[Tutor] ftplib: retrbinary all files in directory

Kent Johnson kent37 at tds.net
Wed Jun 1 06:05:56 CEST 2005


Rich Krauter wrote:
> Israel Carr wrote:
> 
>>I'm using ftplib to connect to a server, and I want to grab every file
>>from a specific folder.  The filenames change frequently.  What is the
>>best way to use retrbinary with wildcards(or some better option) to
>>transfer all files?
>>
>>Thanks,
>>Israel
>>
>>_______________________________________________
>>Tutor maillist  -  Tutor at python.org
>>http://mail.python.org/mailman/listinfo/tutor
>>
> 
> 
> You can try ftpmirror.py, which is included with python.

If you look at line 126 of ftpmirror.py you will see how it uses retrlines('LIST') to retrieve and 
parse the remote directory.

Kent



More information about the Tutor mailing list