Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Auto download files with time stamp

by Scott7477 (Chaplain)
on Jun 20, 2007 at 17:41 UTC ( #622335=snippet: print w/replies, xml ) Need Help??
Description: This script is a variation on this script
that adds a GMT time stamp of when each file is retrieved to the file name:
use strict;
use LWP::Simple;
use POSIX;
use File::Basename;

#usage timestamp_fileget.pl filename.txt
my $filename = shift;
open (DATA, $filename) || die "File open failure!";
while (my $downloadurl = <DATA>){
    (my $name, my $path, my $suffix) = fileparse($downloadurl);
    print "\n";
    print $downloadurl."\n";
    my $timestring = strftime( "%Y%m%d_%H%M%S", gmtime() );
    my $savefilename = $timestring.$name.$suffix;
    print $savefilename."\n";
    my $status = getstore($downloadurl,$savefilename);
        print $status."\n"; 
                }
Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: snippet [id://622335]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (7)
As of 2021-06-15 12:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What does the "s" stand for in "perls"? (Whence perls)












    Results (72 votes). Check out past polls.

    Notices?