All,
In the past I had a bunch of csv or text files sitting on a web server. My script would loop through all of the folders on the web server and pull out the parts of the files that I wanted.
Recently these files have been moved from the web server to a shared drive that I do not control. I cannot setup a new web server on the new drive locations.
Can someone tell me how I can convert my web server references in my script to a windows share drive location?
Script:
use strict;
use Date::Manip;
use LWP 5.64;
#@market = array, is the holder for the requested folder
my @market = ('folder1', 'folder2');
my $lastDate = ParseDate("1/1/09"); #sets the first date to collect
my $numDays = 30; #number of days to collect
my $date=substr(&DateCalc("today","+1 day"),0,8);
foreach my $market(@market) {
open FILE, ">>CFC_Summary_${date}.txt";
for (my $i=0; $i<=$numDays; $i++) {
my $date=substr(&DateCalc($lastDate,"+$i day"),0,8);
my $reportName = "${market}${date}cfc.csv";
print "$market $reportName\n";
my $url = "
my $browser = LWP::UserAgent->new;
my $response = $browser->get($url);
my $content = $response->content;
my @lines = split("\n",$content);
my $j;
my $x;
for ($j=0; $j<$#lines; $j++) {
if ($lines[$j] =~ /Totals/) { $x=1;} # Totals Only
print FILE "$date $market $lines[$j]\n"if ($x > 0);
last if ($lines[$j] =~ /Totals/);
# Here I am looping through the files and grabbing only the line that says Totals
}
}
close FILE;
}
Any help would be greatly appreciated.
Thanks,
RF
In the past I had a bunch of csv or text files sitting on a web server. My script would loop through all of the folders on the web server and pull out the parts of the files that I wanted.
Recently these files have been moved from the web server to a shared drive that I do not control. I cannot setup a new web server on the new drive locations.
Can someone tell me how I can convert my web server references in my script to a windows share drive location?
Script:
use strict;
use Date::Manip;
use LWP 5.64;
#@market = array, is the holder for the requested folder
my @market = ('folder1', 'folder2');
my $lastDate = ParseDate("1/1/09"); #sets the first date to collect
my $numDays = 30; #number of days to collect
my $date=substr(&DateCalc("today","+1 day"),0,8);
foreach my $market(@market) {
open FILE, ">>CFC_Summary_${date}.txt";
for (my $i=0; $i<=$numDays; $i++) {
my $date=substr(&DateCalc($lastDate,"+$i day"),0,8);
my $reportName = "${market}${date}cfc.csv";
print "$market $reportName\n";
my $url = "
my $browser = LWP::UserAgent->new;
my $response = $browser->get($url);
my $content = $response->content;
my @lines = split("\n",$content);
my $j;
my $x;
for ($j=0; $j<$#lines; $j++) {
if ($lines[$j] =~ /Totals/) { $x=1;} # Totals Only
print FILE "$date $market $lines[$j]\n"if ($x > 0);
last if ($lines[$j] =~ /Totals/);
# Here I am looping through the files and grabbing only the line that says Totals
}
}
close FILE;
}
Any help would be greatly appreciated.
Thanks,
RF