Hi,
The following part of the script works when run manually. When triggered automatically (by ftp upload) the remote directory is not recognized. Please let me know what I am doing wrong.
Because the folder is not found the zipfile created is empty.
sub createimgzip
{
$in=$_[0];
$zp=$_[1];
$dt6=$_[2];
$dbcd=$_[3];
chomp($in);
$dbcd2=uc($dbcd);
$remdir="$dbcd\\$dbcd2$dt6"."IDL2";
$imgdir="\\\\FileServer\\DC_Images\\$remdir";
$c=0;
$pat1='\[';
$pat2='.*?txt';
use Archive::Zip qw( :ERROR_CODES :CONSTANTS );
my $zip = Archive::Zip->new();
open (IN,"$in");
while(<IN>)
{
if ($_=~m/($pat1)($pat2)/g)
{
if (-e "$imgdir\\$2") {$c++;my $file_member = $zip->addFile("$imgdir\\$2", $2);}
next;
}
}
unless ( $zip->writeToFileNamed("$zp") == AZ_OK ) {
die 'couldn\'t zip';
}
close(IN);
}
The following part of the script works when run manually. When triggered automatically (by ftp upload) the remote directory is not recognized. Please let me know what I am doing wrong.
Because the folder is not found the zipfile created is empty.
sub createimgzip
{
$in=$_[0];
$zp=$_[1];
$dt6=$_[2];
$dbcd=$_[3];
chomp($in);
$dbcd2=uc($dbcd);
$remdir="$dbcd\\$dbcd2$dt6"."IDL2";
$imgdir="\\\\FileServer\\DC_Images\\$remdir";
$c=0;
$pat1='\[';
$pat2='.*?txt';
use Archive::Zip qw( :ERROR_CODES :CONSTANTS );
my $zip = Archive::Zip->new();
open (IN,"$in");
while(<IN>)
{
if ($_=~m/($pat1)($pat2)/g)
{
if (-e "$imgdir\\$2") {$c++;my $file_member = $zip->addFile("$imgdir\\$2", $2);}
next;
}
}
unless ( $zip->writeToFileNamed("$zp") == AZ_OK ) {
die 'couldn\'t zip';
}
close(IN);
}