[prev in list] [next in list] [prev in thread] [next in thread]
List: sunhelp
Subject: [SunHELP] Fwd: total Number of Files in A Directory
From: "RichT (list addr)" <lmail () catsnest ! co ! uk>
Date: 2006-05-04 16:37:50
Message-ID: 315c8c6f0605040937o764e32d2qd375ebb5a54402 () mail ! gmail ! com
[Download RAW message or body]
--snip--
> How do we know total number of files in a directory on Solaris and AIX.
--snip--
> ls -l|wc -l
--snip--
>ls -l|grep -v '^d'|wc -l
well at least on one of my Sol boxes (5.8)
`ls -l ` outputs like this
# ls -l
total 6
-rw------- 2 owner group date filename
so wc -l ing that would give 2 (as it includes the total filesize line)
so i hacked together the above like this...
echo $((`ls -al | grep -v ^d | wc -l` -1))
of course you can change it to sute you situation ie hidden files directorys
etc.
RichT
Fnord...
<-- http://23.me.uk --> <-- http://info-x.co.uk --> <--
http://wiki.s23.org--> <-- Get FireFox Now -->
<- Engineers believe that if it ain't broke, it doesn't have enough features
yet. - JG Burns ->
_______________________________________________
SunHELP maillist - SunHELP@sunhelp.org
http://www.sunhelp.org/mailman/listinfo/sunhelp
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic