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
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