Unix Shell Script to Find out Files Created within x Hours Without Using mmin / cmin for Solaris

advertisements

_____________________________________________________________________________________________________________________

The Eucharistic Miracles of the World
HW=3 # Modify this variable value. In this example it will find out the files created within last 3 hours.
a=$( date +%H )
if [ $a -gt $HW ]; then
    a=$(( $a - $HW ))
else if [ $a -lt $HW ]; then
    a=$(( $a + 24 - $HW ))
else
    a=00
fi
fi
b=`echo $a | sed -e :a -e 's/^.\{1,1\}$/0&/;ta' `
a=$( date +%Y%m%d$b%M )
touch -t $a /tmp/tst
find . -newer /tmp/tst
rm /tmp/tst

_____________________________________________________________________________________________________________________

Website Stats

0 comments:

Post a Comment

Labels

Oracle (629) Script (86) General (77) Unix (47) Blog (23) Technology (19) gadget (6) games (6) Business (3) OCI (3) SQL* Loader (3) Datapump (2)
 

acehints.com Copyright 2011-23 All Rights Reserved | Site Map | Contact | Disclaimer