Re: URGENT ...ls peut elle compter ...???

Top Page

Reply to this message
Author: Tim Walker
Date:  
To: guilde
Subject: Re: URGENT ...ls peut elle compter ...???
Voici mon p'tit script pour faire ca!


#!/bin/bash
#
# Counts files directories and Symbolic links in a directory.
# By Tim
#
files=0
dirs=0
links=0
echo Directory contains:
for file in *
do
#       echo $file
        if [ -L $file ] ; then
           let "links = links + 1";
        elif [ -d $file ] ; then
           let "dirs = dirs + 1";
        elif [ -f $file ] ; then
           let "files = files + 1";
        fi


done ;
echo -e "Regular files: \t $files"
echo -e "Directories:   \t $dirs"
echo -e "Symb-Links:    \t $links"





-- 
----------------------------------------------------------------------
Tim Walker                                             Hewlett-Packard
Tel:     (+33) 04.76.14.12.33          Telecom Infrastructure Division
Fax:     (+33) 04.76.14.14.88            38053 Grenoble Cedex 9 FRANCE


HamNet:   f4jhd@??? (44.151.38.17)
      f4jhd@???
----------------------------------------------------------------------