SPUG:checking for newer file on FTP server

SPUG-list-owner tim at consultix-inc.com
Fri May 9 20:52:08 CDT 2003


> 
> Trying to check a file on an ftp server to see if it
> has changed ... is newer ... than a prior download. 
> 

Check out the mirror() sub of LWP::Simple, it might do
exactly what you want: 

mirror($url, $file)
  Get and store a document identified by a URL, using If-
  modified-since, and checking of the Content-Length.
  Returns the HTTP response code.

See man-page excerpt below.

=======================================================
| Tim Maher, Ph.D.            tim at timmaher.org        | 
| JAWCAR ("Just Another White-Camel Award Recipient") |
| SPUG Founder & Leader       spug at seattleperl.org    |
| Seattle Perl Users Group    www.seattleperl.org     |
=======================================================

lib::LWP::SimplUser Contributed Perl Documentalib::LWP::Simple(3)

NAME
       get, head, getprint, getstore, mirror - Procedural LWP
       interface

SYNOPSIS
        perl -MLWP::Simple -e 'getprint "http://www.sn.no"'

        use LWP::Simple;
        $content = get("http://www.sn.no/")
        if (mirror("http://www.sn.no/", "foo") == RC_NOT_MODIFIED) {
            ...
        }

        if (is_success(getprint("http://www.sn.no/"))) {
            ...
        }


DESCRIPTION
       This interface is intended for those who want a simplified
       view of the libwww-perl library.  It should also be
...
       mirror($url, $file)
          Get and store a document identified by a URL, using If-
          modified-since, and checking of the Content-Length.
          Returns the HTTP response code.


25/Nov/97                libwww-perl-5.18     lib::LWP::Simple(3)
> Hi,
> 
> This is my first posting... I'm still a Perl newbie.
> So, I figure subscribing here will help improve my
> skills.
> 
> Trying to check a file on an ftp server to see if it
> has changed ... is newer ... than a prior download. 
> 
> I can see how to use NET::FTP to connect and get the
> file. I'm not sure how to do the comparison without
> first downloading the file ... I can store a MD5
> checksum or use the size of file or date to do the
> comparison.
> 
> Open to your suggestions,
> 
> Thanks,
> 
> Al 
> alpgaray at yahoo.com
> 
> 
> __________________________________
> Do you Yahoo!?
> The New Yahoo! Search - Faster. Easier. Bingo.
> http://search.yahoo.com
> _____________________________________________________________
> Seattle Perl Users Group Mailing List  
> POST TO: spug-list at mail.pm.org
> ACCOUNT CONFIG: http://mail.pm.org/mailman/listinfo/spug-list
> MEETINGS: 3rd Tuesdays, U-District, Seattle WA
> WEB PAGE: www.seattleperl.org

-- 

-Tim
*------------------------------------------------------------*
|  Tim Maher (206) 781-UNIX  (866) DOC-PERL  (866) DOC-UNIX  |
|  CEO, JAWCAR ("Just Another White Camel Award Recipient")  |
|  tim at Consultix-Inc.Com  TeachMeUnix.Com  TeachMePerl.Com   |
*+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-*
|  Watch for my Book: "Minimal Perl for Shell Programmers"   |
*------------------------------------------------------------*



More information about the spug-list mailing list