Retrieve FTP directory with hidden files

Oliver Fromme olli at
Fri Jun 25 14:19:58 CEST 2004

Lothar Scholz <dummy at> wrote:
 > I use  the standard  ftplib.FTP  class and get the listing wia
 > ftp.retrlines('LIST mydir')
 > but this does not get hidden files like ".htaccess"

This should work:

ftp.voidcmd("CWD mydir")
ftp.retrlines("LIST -a")

But of course you're at the mercy of the FTP server -- if
it insists on not returning "hidden" files to you, there's
nothing you can do about it.

 > and more important
 > i can't delete directories because they are not empty.

Correct.  You have to delete the files in them first.  The
FTP protocol (RFC959) does not specify recursive removal of
directories, as far as I remember.

Best regards

Oliver Fromme, Konrad-Celtis-Str. 72, 81369 Munich, Germany

``All that we see or seem is just a dream within a dream.''
(E. A. Poe)

More information about the Python-list mailing list