From: superpollo on
Jack ha scritto:
> On May 8, 3:24 pm, Janis Papanagnou <janis_papanag...(a)hotmail.com>
> wrote:
>> Jack wrote:
>>> I need to get the size of a directory with several sub-directories.
>>> Each sub-directory may also have sub-directories. How to do it?
>> du -k your_top_dir_path
>>
>> Janis
>>
>>
>>
>>> Thanks.
>
> I tried "du -k my_dir" and found that it lists the size of each file
> in the directory. What I want is the size (usage of disk space) of the
> whole directory. I do not need the size of each file, For example, if
> the directory occupies 20GB on the disk, I only need to know the
> number 20GB, which should be the summation of the size of all the
> files. Is there any way to do it?

du -hs
From: Janis Papanagnou on
Jack schrieb:
> On May 8, 3:24 pm, Janis Papanagnou <janis_papanag...(a)hotmail.com>
> wrote:
>> Jack wrote:
>>> I need to get the size of a directory with several sub-directories.
>>> Each sub-directory may also have sub-directories. How to do it?
>> du -k your_top_dir_path
>>
>> Janis
>>
>>
>>
>>> Thanks.
>
> I tried "du -k my_dir" and found that it lists the size of each file
> in the directory. What I want is the size (usage of disk space) of the
> whole directory. I do not need the size of each file, For example, if
> the directory occupies 20GB on the disk, I only need to know the
> number 20GB, which should be the summation of the size of all the
> files. Is there any way to do it?

Inspect whether your du(1) supports the option -s (man du). Otherwise
use an additional command tail(1), as in

du -k your_top_dir_path | tail -1


Janis

>
> Thanks.
From: Vivien MOREAU on
On 2010-05-10, Jack wrote:

> I tried "du -k my_dir" and found that it lists the size of each file
> in the directory. What I want is the size (usage of disk space) of the
> whole directory. I do not need the size of each file, For example, if
> the directory occupies 20GB on the disk, I only need to know the
> number 20GB, which should be the summation of the size of all the
> files. Is there any way to do it?

You should consider reading the man page of du(1).
man 1 du

--
Unix is simple. It just takes a genius to understand its simplicity
--Dennis M. Ritchie
From: Jonathan de Boyne Pollard on
>
>
> What I want is the size (usage of disk space) of the whole directory.
>
No. It's clear that you actually don't. Always ask for what you really
want. Directories have sizes of their own on Unix, and those sizes are
independent of the sizes of the files and directories stored within
them. Ask for what you actually want, lest you be given answers that
tell you how to do what you don't want to do, but have nonetheless
stated that you do. Finding the size of a directory in Unix is a simple
matter of the -l (and possibly -d) option to the ls command, for example.

From: Melvin on
On May 11, 2:03 am, Jonathan de Boyne Pollard <J.deBoynePollard-
newsgro...(a)NTLWorld.COM> wrote:
> > What I want is the size (usage of disk space) of the whole directory.
>
> No.  It's clear that you actually don't.  Always ask for what you really
> want.  Directories have sizes of their own on Unix, and those sizes are
> independent of the sizes of the files and directories stored within
> them.  Ask for what you actually want, lest you be given answers that
> tell you how to do what you don't want to do, but have nonetheless
> stated that you do.  Finding the size of a directory in Unix is a simple
> matter of the -l (and possibly -d) option to the ls command, for example.

du -sh * should do the job......


Njoi!!!

Unix Baby