Hi Guys,
I need to count files in a dir which were updated yesterday.
ls -lth | grep -i 'Jul 7' | wc -l
The dir holds files of last 15 days and total count is as 2067476.
Is it efficient to count the files using perl? I have developed the following perl script making use of system().
Can anybody coment, any other way without using system()
#!/usr/bin/perl
@months = (Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec);
($sec,$min,$hour,$monthday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
$month =$months[$mon];
#############################################
# ls -lth | grep -i 'Jul 7' | wc -l
#############################################
$command = "ls -lth | grep -i '" . $month . " " . $monthday -1 . "' | wc -l";
$count = system($command);
print "$count \n";
Thank you
Regards
@Asteroid