ftp a file by date and name match

Discussion in 'Python' started by Bob, Jul 8, 2003.

  1. Bob

    Bob Guest

    I am trying to get the latest file from an ftp site that matches a
    pattern and is the latest one. I have it in Perl and would like to see
    the Python version for comparison.

    Perl version:

    # this matches the name only by looking at files
    # that start with 8 numbers (i.e. 20021203)
    foreach(@list) {
    if(m/\d{8}.*x86.exe/) {
    push(@match,$_)
    }
    }

    if(scalar(@match)) {
    my $file=$match[$#match];
    $ftp->binary();
    $ftp->get($file);
    }
    $ftp->quit;
     
    Bob, Jul 8, 2003
    #1
    1. Advertising

  2. Bob

    Bob X Guest

    "John Hunter" <> wrote in message
    news:...
    > >>>>> "Bob" == Bob <> writes:

    > Perhaps you'll join the ranks of the converted?
    >
    > JDH


    Perhaps! I am looking forward to 2.3.
     
    Bob X, Jul 9, 2003
    #2
    1. Advertising

  3. Bob

    Bob Guest

    John Hunter <> wrote in message news:<>...
    > >>>>> "Bob" == Bob <> writes:

    >
    > Perhaps you'll join the ranks of the converted?


    Mayhaps. : )

    The only problem I am having is that I do NOT know the name of the
    file to match, only the pattern of the file name.
     
    Bob, Jul 10, 2003
    #3
    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. Peter Grison

    Date, date date date....

    Peter Grison, May 28, 2004, in forum: Java
    Replies:
    10
    Views:
    3,278
    Michael Borgwardt
    May 30, 2004
  2. Aparna
    Replies:
    2
    Views:
    549
    Martin Gregorie
    Jun 14, 2007
  3. Jeff Miller
    Replies:
    0
    Views:
    504
    Jeff Miller
    Mar 26, 2009
  4. D. Buck
    Replies:
    2
    Views:
    493
    D. Buck
    Jun 29, 2004
  5. Nex_s
    Replies:
    8
    Views:
    104
    Paul Lalli
    Aug 3, 2005
Loading...

Share This Page