Hi,
Need some help in figuring out how to find out if the folder is modified within last 11 days and then going through the folder content and checking if any of the files are modified within last 5 days. Here is the code I am trying but some how it doesn't work:
running the above script gives the following output and it doesn't seem to be right as the folder is modified in last 11 days and does contain some files modified within last 5 days.
Any help is really appreciated. Thanks
Need some help in figuring out how to find out if the folder is modified within last 11 days and then going through the folder content and checking if any of the files are modified within last 5 days. Here is the code I am trying but some how it doesn't work:
Code:
#!/usr/bin/perl
# Check if the directory is modified within last 11 days
# Check if the files of the directory are modified in last 5 days
opendir(DIR,"C:\\test\\data");
my @dir=grep { !/^\.+$/ } readdir(DIR);
if (-M $dir < 11)
{
print "Last Directory change:\t" . scalar localtime($dir) . "\n";
}
closedir(DIR);
foreach $file (@dir)
{
if (-M $file < 5)
{
print "************************Last change:\t" . scalar localtime($file) . "\n";
}
}
running the above script gives the following output and it doesn't seem to be right as the folder is modified in last 11 days and does contain some files modified within last 5 days.
Code:
Last Directory change: Wed Dec 31 18:00:00 1969
Any help is really appreciated. Thanks