On Mon, Jan 26, 2009 at 9:51 PM, Todd Walton <[email protected]> wrote:
> On Fri, Jan 9, 2009 at 6:48 AM, Bipinchandra Ranpura <[email protected]>
> wrote:
>> How can I get total # of files and its total size in current directory at
>> command line. Similar to DOS DIR command.
>
> 'du -s' will give you total size of all files together.
> 'ls -1 | wc -l' will give you the number of files and directories in
> the current directory.
>
> A clever grep will exclude directories from your count.

ls -al | grep -v ^d | wc -l

If you don't like using too many pipes,

find /directory -type f -prune -name "*" | wc -l

Regards,
NMK.

Reply via email to