Retrieve FTP directory with hidden files

L

Lothar Scholz

Hello,
i know that this is not a python but a FTP protocol question but maybe
someone in this newsgroup could help me.

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" and more important
i can't delete directories because they are not empty.
 
O

Oliver Fromme

Lothar Scholz said:
> 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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,023
Latest member
websitedesig25

Latest Threads

Top