Good afternoon,
I am working a script where it goes into a specific directory and delete files ending .edi. Then within the same script goes into another directory/folder and delete different files. However I when I run the script on MSDos I would get the error message of "Can't modify subtraction (-) in scalar assignment at delete_old_files.pl line 29, near ""/outbound/Perl/ISD-EDI/TS210IB-BK";"
Below is what I have for the script:
use File::Copy;
$dir_210IB = "/outbound/Perl/ISD-EDI/TS210IB";
$retention_period_210IB = "3";
## OPEN AND READ THE DIRECTORY
opendir (DIR, "$dir_210IB/");
@FILES = grep(/a*.edi/,readdir(DIR));
closedir (DIR);
## DELETE THE .EDI FILES THAT ARE OLDER THAN X NUMBER OF DAYS
foreach $FILES (@FILES) {
if (-M "$dir_210IB/$FILES" > $retention_period_210IB) {
print "$FILES\n";
unlink("$dir_210IB/$FILES");
}
}
## DELETE IB210-BK
$dir_210IB-BK = "/outbound/Perl/ISD-EDI/TS210IB-BK";
$retention_period_210IB-BK = "3";
## OPEN AND READ THE DIRECTORY
opendir (DIR, "$dir_210IB-BK/");
@FILES = grep(/a*.edi/,readdir(DIR));
closedir (DIR);
## DELETE THE .EDI FILES THAT ARE OLDER THAN X NUMBER OF DAYS
foreach $FILES (@FILES) {
if (-M "$dir_210IB-BK/$FILES" > $retention_period_210IB-BK) {
print "$FILES\n";
unlink("$dir_210IB-BK/$FILES");
}
}
I am working a script where it goes into a specific directory and delete files ending .edi. Then within the same script goes into another directory/folder and delete different files. However I when I run the script on MSDos I would get the error message of "Can't modify subtraction (-) in scalar assignment at delete_old_files.pl line 29, near ""/outbound/Perl/ISD-EDI/TS210IB-BK";"
Below is what I have for the script:
use File::Copy;
$dir_210IB = "/outbound/Perl/ISD-EDI/TS210IB";
$retention_period_210IB = "3";
## OPEN AND READ THE DIRECTORY
opendir (DIR, "$dir_210IB/");
@FILES = grep(/a*.edi/,readdir(DIR));
closedir (DIR);
## DELETE THE .EDI FILES THAT ARE OLDER THAN X NUMBER OF DAYS
foreach $FILES (@FILES) {
if (-M "$dir_210IB/$FILES" > $retention_period_210IB) {
print "$FILES\n";
unlink("$dir_210IB/$FILES");
}
}
## DELETE IB210-BK
$dir_210IB-BK = "/outbound/Perl/ISD-EDI/TS210IB-BK";
$retention_period_210IB-BK = "3";
## OPEN AND READ THE DIRECTORY
opendir (DIR, "$dir_210IB-BK/");
@FILES = grep(/a*.edi/,readdir(DIR));
closedir (DIR);
## DELETE THE .EDI FILES THAT ARE OLDER THAN X NUMBER OF DAYS
foreach $FILES (@FILES) {
if (-M "$dir_210IB-BK/$FILES" > $retention_period_210IB-BK) {
print "$FILES\n";
unlink("$dir_210IB-BK/$FILES");
}
}