using python ftp

Discussion in 'Python' started by Matt Funk, Dec 23, 2010.

  1. Matt Funk

    Matt Funk Guest

    Hi,

    i was wondering whether someone can point me whether the following
    already exists.

    I want to connect to a server , download various files (for whose name i
    want to be able to use a wildcard), and store those files in a given
    location on the hard drive. If the file already exists i do not want to
    download it.

    This seems fairly trivial and i would assume that there should be some
    sort of implementation that does this easily but i didn't find anything
    googling it.

    Otherwise i was going to do it "by hand" using ftplib:
    1) connect to server,
    2) change to directory on server
    3) get listing
    4) match the file pattern i want to the listing
    5) check if file already exists
    6) download file if matched and doesn't exist

    Can anyone offer any advice whether this already done somewhere?

    thanks
    matt
     
    Matt Funk, Dec 23, 2010
    #1
    1. Advertising

  2. Hello Matt,

    On 2010-12-23 01:03, Matt Funk wrote:
    > i was wondering whether someone can point me whether the following
    > already exists.
    >
    > I want to connect to a server , download various files (for whose name i
    > want to be able to use a wildcard), and store those files in a given
    > location on the hard drive. If the file already exists i do not want to
    > download it.
    > [...]


    You might want to check out ftputil:

    http://ftputil.sschwarzer.net/
    http://ftputil.sschwarzer.net/trac/wiki/Documentation

    > Otherwise i was going to do it "by hand" using ftplib:
    > 1) connect to server,
    > 2) change to directory on server
    > 3) get listing
    > 4) match the file pattern i want to the listing
    > 5) check if file already exists
    > 6) download file if matched and doesn't exist
    >
    > Can anyone offer any advice whether this already done somewhere?


    ftputil will do most of these tasks easily. For step 4
    you probably want to use Python's fnmatch module, see
    http://docs.python.org/library/fnmatch.html .

    If you have questions on ftputil, there's also a
    mailing list:
    http://ftputil.sschwarzer.net/trac/wiki/MailingList
    (You need to be subscribed to the list to post, though.)

    Stefan
     
    Stefan Schwarzer, Dec 31, 2010
    #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. someone

    FTP over SSL vs FTP over SSH

    someone, Apr 24, 2004, in forum: Java
    Replies:
    1
    Views:
    4,638
    iksrazal
    Apr 25, 2004
  2. Replies:
    3
    Views:
    5,748
  3. Jeff Miller
    Replies:
    0
    Views:
    551
    Jeff Miller
    Mar 26, 2009
  4. D. Buck
    Replies:
    2
    Views:
    568
    D. Buck
    Jun 29, 2004
  5. Asaf Sinai
    Replies:
    1
    Views:
    293
    Chris Davies
    Jul 4, 2006
Loading...

Share This Page