#!/usr/bin/perl -w use LWP::Simple; my $filename = "http://sample.com/secure/sample.xls"; MakeFileLocal($filename); sub MakeFileLocal { my $filename = shift; chomp($filename); $filename =~ m/.*\.(.*)$/; my $suffix = $1; print "Suffix : $suffix\n"; my $newname = "d:/test/mohan/temp.$suffix"; unlink("$newname"); if ($filename =~ m/^http/i) { print "Name matches starts with http://\n"; my $retval = getstore($filename, $newname); die "Could not store it!!\n" unless is_success($retval); } else { my $cmd = qq~copy "$filename" "$newname"~; print "$cmd\n"; my @a = `$cmd`; } if (-e "$newname") { return $newname; } return 0; }
In reply to HTTP file download by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |