Retrieve FTP directory with hidden files

Discussion in 'Python' started by Lothar Scholz, Jun 25, 2004.

  1. 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.
     
    Lothar Scholz, Jun 25, 2004
    #1
    1. Advertising

  2. Lothar Scholz <> 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

    --
    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)
     
    Oliver Fromme, Jun 25, 2004
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Cipher
    Replies:
    1
    Views:
    3,572
    Natty Gur
    Jul 11, 2004
  2. Rick
    Replies:
    3
    Views:
    8,373
    Alexey Smirnov
    Apr 13, 2010
  3. D. Buck
    Replies:
    2
    Views:
    540
    D. Buck
    Jun 29, 2004
  4. Jason  Priest
    Replies:
    2
    Views:
    182
    Joe Smith
    Jan 8, 2005
  5. SolarCanine
    Replies:
    2
    Views:
    308
    SolarCanine
    Sep 20, 2005
Loading...

Share This Page