use Data::Dumper; use POSIX qw(strftime); use File::Copy; if($#ARGV == -1 || $#ARGV != 0) { die("\nPlease enter the Compressed folder name along with extension as an argument!\n"); exit; } my $compPackage = $ARGV[0]; my $dir = "."; my $input_dir = ''; if(index($compPackage, ".zip") != -1) { print "Extracting the ZIP package..\n"; system ("unzip -u $compPackage"); print "Extraction Completed\n"; $input_dir = substr $compPackage, 0, -4; } else { $input_dir = $compPackage; print "Folder Processed\n"; } chmod 0755, $input_dir; opendir D, $input_dir or die "Could not open dir: $!\n"; my @fileName = grep(/index/i, readdir D); if(index(@fileName, "txt") == -1) { die("Index file not found / is not valid!.\nPlease ensure the index file is in the Input folder and with '.txt' extension\n"); exit; }