[SunHELP] total Number of Files in A Directory
ssandau at gwi.net
Mon May 1 05:41:37 CDT 2006
> Hello Saim,
> Solaris and AIX - both are different flavours - but still UNIX.
> ls -l|wc -l (calculate the no. of files in the current dir)
> ls -la|wc -l (calculate the no. of files in the current dir including hidden
The way above is my standard method, too. If you need an exact count,
though, be aware that the -la option to ls will give you a count that
includes the current directory and the parent directory, so you need to
> ls -lR|wc -l (calculate the no. of files in the current dir and beneath -
> with subdirectories)
> ls -laR|wc -l (calculate the no. of files in the current dir and beneath
> including the hidden ones)
> find . -type f |wc -l (find all files and calculate the number including
> whatever files in the subdirectoris beneath)
> find . -type d|wc -l (find all dirs and calculate the number including
> whatever subdirectoris beneath)
> Just check the prune option with the find (man find) for more info.
> Rasheed Tamton.
> -----Original Message-----
> From: sunhelp-bounces at sunhelp.org [mailto:sunhelp-bounces at sunhelp.org] On
> Behalf Of Abrar, Saaim M.
> Sent: Monday, May 01, 2006 11:04 AM
> To: sunhelp at sunhelp.org
> Subject: [SunHELP] total Number of Files in A Directory
> Hello Gurus,
> How do we know total number of files in a directory on Solaris and AIX.
> Many Regards
> Saaim Abrar
> System Engineer
> Jeraisy Computers and Communications
> Oracle Certified 10G Professional
> Database Administrator
> Sun Solaris 8 Certified UNIX System Administrator Cellular 00966-508160132
More information about the SunHELP