#!/bin/sh
#
# @(#)tree
#
# Calling the filter...

usage="Usage: $0 [ [-f|s|t] [-d depth] path | --help]

    -f          show files per directory
    -s          show size of files in each directory
    -t          show grand total of subdirectories
    -d depth    proceed down to depth directories
    --help      display this help and exit
"

test "$1" = "--help" && echo "$usage" && exit

for i in $@
do
 if [ $# -ne 1 ]
 then passpar="$passpar $1"
 else dir=$1
 fi
 shift
done

if test -d "${dir:=`pwd`}"
then 
   cd $dir
else 
   echo "No such directory."
   exit
fi

pwd

ls -lAR | treeFilt $passpar

