zip up files and save in folder:
use CGI;
use CGI qw/:standard/;
#delete all files from dir first and save the zip file.
$mydir = "D:\\www-root\\www-esp\\marketing\\campaigns\\";
opendir(DIR, "$mydir");
@allfiles = readdir(DIR);
closedir(DIR);
foreach $file (@allfiles) {
unlink $mydir . $file;
}
$docsDir ="D:\\www-root\\www-esp\\";
@URLS = param('GN');
$code_name = param('code_name');
#print "urls here @URLS";exit();
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
$Timestamp = "$hour"."$min"."$sec";
$code_name = $code_name . $Timestamp;
for $sURL (@URLS) {
$h = 'http://esp.ibi.com/';
$sURL =~ s/$h/$docsDir/;
$sURL =~ s/\//\\/g;
#open (FH, "$sURL") || die "died opening the file $!";
#close(FH);
}
$fileList = join(' ', @URLS);
#print "c:\\PROGRA~1\\WinZip\\wzzip.exe -a $docsDir\marketing\\campaigns\\$code_name.zip $fileList";exit();
$sy = system("c:\\PROGRA~1\\WinZip\\wzzip.exe -a $docsDir\marketing\\campaigns\\$code_name.zip
$fileList");
#print "$sy";exit();
print "Location: http://esp.ibi.com/marketing/campaigns/$code_name.zip\n\n";
exit();