#!/usr/local/bin/perl -w use LWP::Simple; # Provide the URL for file to monitor my $url = "ftp://ftp.ncbi.nlm.nih.gov/blast/db/FASTA/pdbnt.gz"; my $file = "pdbnt.gz"; # Invoke the LWP mirror utility which will compare # the files by date stamp my $rc = mirror($url, $file); # If downloaded OK then 200 code # If file is same date as local copy it returns # 304 code For details on various codes, see # ftp://ftp.rfc-editor.org/in-notes/rfc2616.txt if ($rc == 200) { # Could send email to inform user ! print "$file downloaded correctly\n"; } elsif ($rc == 304) { print "$file is up to date\n" } elsif (!is_success($rc)) { print "Problem code:$rc ", status_message($rc), "($url)\n"; }