Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Outputting a missing file script.

Status
Not open for further replies.

tijerina

Vendor
Mar 4, 2003
132
US
Hello,

Can anybody assist me in extracting the name of a list of files that show a missmatch. The goal is to audit the files in a directory against a base file that I have. If the base file does not match then I get a number mismatch, I was thinking it would be a great feature if I could have the name of the file that does not match. So the output would be 4000 files in Base file and 3999 files in current Dir, One file missing, this is the file that is missing /Dir/FileName.

Please help, and all help will be greatly appreciated.

Dickie Bird helped out before and I do thank you.




Here is what I am doing:

#!/bin/ksh
auditlog=/logdir/logfile
echo " File count test " > $auditlog
for dirs in /adir /bdir /cdir /ddir
do
basecount=`cat ${dirs}/basefile` #contains no. of files
dircount=`ls ${dirs/*|wc -l`
if [ $dircount -ne $basecount ]
then
echo "Imbalance in $dirs - Count=$dircount - Should be $basecount" >> $auditlog
else
echo "OK in $dirs - Count=$dircount - Same as $basecount" >> $auditlog
fi
done



 
for dir in /adir /bdir /cdir /ddir
do
while read xx
do
if [ ! -f $dir/$xx ] ;then
echo $dir/$xx is not found.
fi
done < $dir/basefile
done

regards Gregor

Gregor.Weertman@mailcity.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top