The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Advanced & Expert Users
Google UNIX.COM



View Single Post in UNIX Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 09-01-2007
bsandeep_80 bsandeep_80 is offline
Registered User
 

Join Date: Jul 2007
Posts: 103
Help with search script

HI all,

I am trying to find files that have .cc3 file extenstion folder using this script below, but this fails as there are files in the folder and i get a message saying i have no files. Please anyone reveiw and let me know if i am missing anything.I am working on this from two days and i don't know where i have gone wrote. I would be gratefull for any help on this

##!/usr/bin/sh -x
##Initialising variables

FROM_DIR=/disk1/sandeep/cc3/perry; export FROM_DIR
LOG_DIR=/disk1/sandeep/log/perry; export LOG_DIR

echo "COSTING CC3 FILE Check started........................................" > $LOG_DIR/perry.log
echo " " >> $LOG_DIR/perry.log
cd $FROM_DIR

check=`ls|grep cc3|wc -l`

if [ $check -ne 0 ]

then
echo "INPUT FILE NOT FOUND FOR TODAY................................" > $LOG_DIR/errorperry.log
echo " " >> $LOG_DIR/errorperry.log
echo " " >> $LOG_DIR/errorperry.log
echo "Please verify the reason for the FAILURE....................." >>$LOG_DIR/errorperry.log
echo " " >> $LOG_DIR/errorperry.log
echo " " >> $LOG_DIR/errorperry.log
echo "EXITING FROM PROCESS..............................................................." >>$LOG_DIR/errorperry.log
cd $LOG_DIR
cat /disk1/stonehs1/log/perry/errorperry.log|mailx -s "ALERT-NO FILE FOUND" `cat maillist`
exit 1
else
echo "INPUT FILE FOUND FOR TODAY...................................." >> $LOG_DIR/perry.log
echo " " >> $LOG_DIR/perry.log
echo "NUMBER OF RECORDS IN INPUT FILE STarts.............................." >> $LOG_DIR/perry.log
echo " " >> $LOG_DIR/perry.log
echo " " >> $LOG_DIR/perry.log
wc -l *.cc3 >> $LOG_DIR/perry.log
echo " " >> $LOG_DIR/perry.log
echo " " >> $LOG_DIR/perry.log
echo " " >> $LOG_DIR/perry.log
cat /disk1/stonehs1/log/perry/perry.log|mailx -s "ALERT-FILE FOUND" `cat maillist`
exit 0

thanks,
Sandeep
Reply With Quote
Remove advertisements
!!
Forum Sponsor