Script which will search for a file for 15 mins

Hi All,

I would like to write a script which will search a file say abc.dat in /a/b/data for 15 mins only. If the script finds the file in 15 mins then it will exit will exit sucessfully and if there is no file for 15 mins it will exit and copy the last day file (abc.dat_ddmmyyhhmmss) from a/b/processed to /a/b/data and rename it as abc.dat.

I hope my question will be clear for you if not then I apologies I will try to make it in point .

Many Thanks in Advance.

Chandan

Something like this :

count=0
cd /a/b/data

while true ;
do

if [ -f abc.dat ] ; 
then 
echo "success"
else
           if [ $count -eq 15 ]; then 
           ##do what ever operation u want like copy the file 
           echo "copied" 
           exit 
           else
           count=`expr $count + 1`
           sleep 60
           fi
fi