John W. Krahn wrote: > > Perlwannabe wrote: > > > > There is a .pdf file on a website that I would like to download on a daily > > basis. The site puts up a new .pdf file everyday and I would like to > > write a simple script to download the file to my computer. > > > > The URL basically adds the name of the file with the date, i.e. > > > > http://www.samplesite.com/files/August23.pdf > > > > all I want to do is get the file. Obviously the .pdf will change to > > August24.pdf on the 24th. I looked all over and the stuff available looks > > way to sophisticated for what I want (i.e. mywebget). I just want a > > simple script to download the file. > > > > Seems easy enough, but tough to find information on how to do it. > > This should work (untested): > > #!/usr/bin/perl > use warnings; > use strict; > use POSIX 'strftime'; > use LWP::Simple; > > my $url = 'http://www.samplesite.com/files'; > my $file = strftime '%B%d.pdf', localtime; > > getstore( "$url/$file", $file ); > > __END__
Changing the last line to this my $rc = getstore( "$url/$file", $file ); print status_message($rc), "\n"; will tell you whether the transfer succeeded or, if not, what the returned error code meant. HTH, Rob -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]