ftp a file by date and name match

B

Bob

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;
 
B

Bob

John Hunter said:
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.
 

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

Forum statistics

Threads
474,077
Messages
2,570,568
Members
47,204
Latest member
abhinav72673

Latest Threads

Top