$ touch a $ touch b -t `date -d "-1 days" '+%Y%m%d%H%M'` $ ls -l total 0 -rw-r--r-- 1 oracle oinstall 0 Feb 3 16:10 a -rw-r--r-- 1 oracle oinstall 0 Feb 2 16:10 b $ ls|while read line do if [ "`stat --print=%y $line|perl -ple 's/([0-9\-:\s]{13}).*/\1/'`" == "`date '+%Y-%m-%d %H'`" ]; then echo "$line is modified within an hour." else echo "$line is not modified within an hour." fi done a is modified within an hour. b is not modified within an hour.