Hi Friends,
I want to the list the files in the folder which was access before 2 hours in Solaris.
Thanks in advance......
Hi Friends,
I want to the list the files in the folder which was access before 2 hours in Solaris.
Thanks in advance......
Try this...
find /from/where/to/search -amin 120
--ahamed
amin option is not working in Solaris OS.
The hard way.
[highlight=bash]#! /bin/bash
CURR_DATE=`date +%Y%m%d`
TIME_2hrs_ago=`date --date="-2 hours" +%H%M`
for x in `ls`
do
FILE_ACC_DATE=`stat $x | sed -n 5p | awk '{print $2}' | tr -d '-'`
FILE_ACC_TIME=`stat $x | sed -n 5p | awk '{print $3}' | tr -d ':' | cut -c1-4`
if [ $FILE_ACC_DATE -eq $CURR_DATE -a $FILE_ACC_TIME -gt $TIME_2hrs_ago ]
then
continue
else
echo $x
fi
done[/highlight]