#------------------------------------------------------------------------------ 
# @(#) dtree        : Visual display of directory tree                          
# module name / nom :dtree                                                      
# module type / type: procedure script shell (UNIX)                             
# But / Aim         : Affiche a l'ecran l'arborescence des repertoires et des   
#                     sous-repertoires sous la forme d'un arbre                 
# Auteur/Author     :  ?                date creation / creation date: 07-SEP-90
#                                                                               
# Usage / Usage     : dtree [repertoire]                                        
#                     dtree [starting-directory-name]                           
#------------------------------------------------------------------------------ 
#                                                                               
USAGE="Usage: $0 [starting-directory-name]"                                     
case $# in                                                                      
   0) startdir=".";; # Use current directory                                    
   1) if [ ! -d $1 ]; then                                                      
         echo "\"$1\" not a directory." >&2                                     
         echo $USAGE >&2                                                        
         exit 1                                                                 
      fi                                                                        
      startdir=$1 ;;                                                            
   *) echo $USAGE >&2                                                           
      exit 2 ;;                                                                 
esac                                                                            
 (cd $startdir; pwd)                                                            
find $startdir -type d -print 2> /dev/null | sort -f |                          
sed -e "s,^$startdir,," \
-e "/^$/d" \
-e "s,[^/]*/\([^/]*\)$,\`-----\1," \
-e "s,[^/]*/,|      ,g"                                                         
                                                                                
