file counting script

From: Ty Heath <heath_at_mediadefender.com>
Date: Wed, 2 May 2007 15:16:25 -0700

#this script will work on any unix/linux system
files=0
directs=0
for name in `ls` # this is incrementing the ls command.
do
   if [ -f $name ] # is it a file?
   then
     let files=files+1
   elif [ -d $name ] # is it a directory?
   then
     let directs=directs+1
  fi
  done

echo "the number of directories is $directs"
echo "the number of files is $files"
Received on Fri Sep 14 2007 - 10:55:54 BST

This archive was generated by hypermail 2.2.0 : Sun Sep 16 2007 - 22:19:46 BST