se strict;
use warnings;
use Data::Dumper;
use Switch;
use File::stat;
use Time::localtime;
use POSIX ();
print ("Enter the directory name and date as input arguments:");
my $which_directory;
my $which_date;
###$tm = localtime;
my $mtime;
my $file;
$which_directory = $ARGV[0];
print (" The first argument is $ARGV[0]\n" ) ;
$which_date = $ARGV[1];
print (" The secnd argument is $ARGV[1]\n");
die("Nothing entered as directory path name\n") if ($which_directory e
+q "");
die("Nothing enetered as update date\n") if ($which_date eq "");
opendir(DIR,$which_directory) || die "Error in opening dir $which_d
+irectory\n";
my @dir = grep { !/^\.+$/ } readdir(DIR);
my $i = 0;
foreach (@dir)
{
readdir($ARGV[0] . "/" . $dir[0]);
$mtime = (stat ($file))[9];
print " Time--->" . ($mtime).$file . "\n";
print "Last change:\t" . ($mtime).$file . "\n";
$i++;
}
closedir(DIR);
$ perl test_ash.pl /var/opt/nexius/cm/westtr3/oss/ericsson 01/01/2011
Enter the directory name and date as input arguments: The first argument is /var/opt/nexius/cm/westtr3/oss/ericsson
The secnd argument is 01/01/2011
Bad symbol for filehandle at test_ash.pl line 39.
Is there any other approach for reading and entering into the subdirectory ? I saw the File::Find but did not get anything of relevance! . Please guide |