hi,
I want to find a file which is modified within last 2 hours
i am using sun-os
i tried find . -name <filename> -mmin 120
i found that mmin option is not supported in sun-os is there any other alternative option
suggestions welcome
thanks in advance
You need perl, python or C - here is perl
#!/bin/ksh
secs()
{
perl -e '
$mtime = (stat $ARGV[0])[9];
$diff = time() - $mtime;
if ($diff > ( $ARGV[1] * 3600 ))
{
print "1";
}
else
{
print "0";
}
' $1 $2
}
hours=2
for file in `ls *.pl`
do
older=$(secs $file $hours)
if [[ $older -eq 1 ]] ; then
echo "$file is older"
else
echo "$file is not older"
fi
done
please try the mtime option. check the man page of find.
What is the first check for? -- comparing diff to 3600
or touch a file with the timestamp
and then use find with the option -newer
-Devaraj Takhellambam