1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

[Python] How do I recursively search for a file in an FTP server using Python? [closed]

Discussão em 'Python' iniciado por Stack, Setembro 16, 2025.

  1. Stack

    Stack Membro Participativo

    I need to find a file with a specific text in a section of its name to download. How can I recursively search using Python's FTP library?

    I know you can list files and directories with .nlst(). The issue is recursion. I am unsure how to check for a file that has a title containing a certain string recursively.

    Example:

    I have an ftp server multiple layers deep:

    folder a
    ---> folder aa
    ---> folder aaa
    ---> folder aaa
    ---> ---> randomstringoftext1341341-fileishere.pdf
    folder b
    ---> folder bb
    ---> folder bbb
    ---> folder bbbb
    ---> ---> someotherfile.pdf
    ---> folder bbbbb



    I need to find and download randomstringoftext1341341-fileishere.pdf but all I have is 1341341.

    Can I iterate over values in .nlst() to find a file containing 1341341 to download?

    Continue reading...

Compartilhe esta Página