Hi Everyone,

 

I am very new to perl so I am not sure why my script is only partially
working, so here is the problem.  

 

I am trying to compress files with certain filenames that are older than
7 days.  But when running the script it only compresses the first file
only and I get errors on the rest.  I know it's not a permissions issue
with the files because when I run the script a second time it will
compress the next file successfully and get errors on the remaining
files.

 

I am using AIX operating system.

 

Any help would be greatly appreciated.  Thanks in advance.

 

Rob McGinness

 

 

ERROR Messages

sh[2]: Completed.archive.4: 0403-006 Execute permission denied.

sh[3]: Completed.archive.5: 0403-006 Execute permission denied.

 

 

Script

#!/usr/bin/perl

 

die unless chdir
"/cert/ImpactServer-5_4/cl9/ctrl_sfm9/sfm9_sched/archives";

die unless opendir DIR, ".";

 

my @list1 = `ls Completed.archive.[0-9]`;                       # list
of single digit archive files.

my @list2 = `ls Completed.archive.[0-9][0-9]`;                  # list
of double digit archive files.

my @list3 = `ls Completed.archive.[0-9][0-9][0-9]`;             # list
of triple digit archive files.

my @list4 = `ls Completed.archive.[0-9][0-9][0-9][0-9]`;        # list
of quadruple digit archive files.

my @list = sort "@list1"."@list2"."@list3"."@list4";            #
combined list of 1,2,3,4 excluding .Z ext.

my @zfile = grep(7 < -M, @list);                                # list
of combined 1,2,3,4, older than 7 days.

 

foreach (@zfile) {

 

system "compress -v ".$_ ;      # AIX command to compress files.

#print $_ ;                     # print to screen.

 

}

closedir DIR; 
  
  
This message (and any included attachments) is from Rutland Regional Health 
Services and is intended only for the addressee(s). The information contained 
herein may include privileged or otherwise confidential information.  
Unauthorized review, forwarding, printing, copying, distributing, or using such 
information is strictly prohibited and may be unlawful. If you received this 
message in error, or have reason to believe you are not authorized to receive 
it, please promptly delete this message and notify the sender by e-mail. 
 Thank  You 

Reply via email to