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

_____________________________________________________________________________________________________________________

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 (580) General (60) Unix (47) Script (41) Blog (23) OCI (3) SQL* Loader (3) Datapump (2) Software (1)
DBA Tips
 

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