polling using sftp process during a specific time period

Hi all,
I need to add a process to poll for the files using sftp during the specific time period .How to i add this to the exsiting script.

my requirement is to add a process to the below script which has to poll every 5 min from 5 A.M to 12 P.M. How do i do this?

comdta=/var/opt/etl/datsrc/3com/data
cominp=/var/opt/etl/datsrc/3com/input
comtmp=/var/opt/etl/datsrc/3com/temp
comlog=/var/opt/etl/datsrc/3com/log
logdate=`date +%Y%m%d%H%M%S`;
lognm="3com_FTP_$logdate.log"
trgr_file="3Com_Files_Delivered.txt"
infile="3Com_*"
maillist=`eval echo $TCOM_MAIL_LIST`
flag="N"
 
####################################################################
#
#REMOVING LOG FILES OLDER THAN 30 DAYS
#
####################################################################
find $comlog -type f -name '3com_FTP_*.log' -follow -mtime +30 -exec rm {} \; -print
 
#----Log Errors in Log File---------#
inf_log()
{
echo "INFO: $@" >> $comlog/$lognm
}
err()
{
echo "ERROR: $@" >> $comlog/$lognm
exit 1
}
 
#######################################################################
#
# FTP PROCESS To check the existence of the trigger file every 5 min
# and if exist move all the input files from SFTP Server to 3com folder
#
#######################################################################
 
cd $cominp
 
echo Log BEGIN For $logdate>$comlog/$lognm
 
while [ "$flag" != "Y" ]
do
sftp -b - $TCOM_SFTP_FILES <<EOF >$comlog/$lognm
get /$trgr_file
bye
EOF
if [[ -f $trgr_file ]]; then
inf_log "Trigger File Exist on SFTP Server........."
inf_log "Copying 3Com Files Started.........."
sftp -b - $TCOM_SFTP_FILES <<EOF >$comlog/$lognm
mget /$infile
bye
EOF
flag='Y'
else
sleep 300
fi
done
#--------Now copying Plan,Pipeline,Forecast file(s) from input to data directory-------#
cp 3Com_Plan* $comdta
cp 3Com_Pipeline* $comdta
cp 3Com_Forecast* $comdta
 
#-------Mail SFTP status----------------------------#
grep -q 'Fetching' $comlog/$lognm
if [ $? -eq 0 ]; then
inf_log "SFTP File Transfer Success!!!"
else
echo "SFTP File Trasnsfer Failed\n"|mailx -s "3COM File Transfer Failed -ERROR" $maillist
err " SFTP file transfer Failed - File is not Found!!!"
exit 1
fi
 
#-------Remove input file(s) from SFTP Server-------#
sftp -b - $TCOM_SFTP_FILES <<EOF >>$comlog/$lognm
cd /
rm $infile
quit
EOF
 
#-------Notifying SFTP File(s) Removal Status-------#
grep -q 'not found' $comlog/$lognm
if [ $? -eq 0 ]; then
err " Removal of 3Com File(s) from SFTP Box Failed!!!"
else
inf_log " Removal of 3Com File(s) from SFTP Box is Success!!!"
exit 0
fi

please guide me onthis very urgent for me.

appreciate your help
narasimharao.

if [ `date +"%H"` -lt 5 ] 
then
don't look for files
fi