From: rvaede on

If I do an ls -al 2006* in a directory how can I find the size of
these files?
I am having trouble combining the two using the du command
From: Anonymous on
If they are plain files, du -sk 2006*, or ls -ls 2006*.

If they are directories, do they contain . files?

From: hume.spamfilter on
rvaede <rvaedex23(a)gmail.com> wrote:
> If I do an ls -al 2006* in a directory how can I find the size of
> these files?
> I am having trouble combining the two using the du command

du sums *each* on the command line, not stdin or the sum of all the files
given.

You don't need ls for this (and the -a and -l actually hurt you). Use
something like:

du -k 2006* | awk '{ sum += $1; } END { print sum }'

And that will print the number of kilobytes used just by the 2006* files
and directories in the current directory.

--
Brandon Hume - hume -> BOFH.Ca, http://WWW.BOFH.Ca/
From: rvaede on
On May 26, 12:47 pm, Anonymous <cri...(a)ecn.org> wrote:
> If they are plain files, du -sk 2006*, or ls -ls 2006*.
>
> If they are directories, do they contain . files?

Yes there are subdirectories thats the issue.
From: starwars on
On May 26, 12:47 pm, Anonymous <cri...(a)ecn.org> wrote:
> rvaede
> > If they are plain files, du -sk 2006*, or ls -ls 2006*.
> > If they are directories, do they contain . files?
>
> Yes there are subdirectories thats the issue

I am unsure exactly what you are trying to do. You said:

> If I do an ls -al 2006* in a directory how can I find the size
> of these files?

and:

> there are subdirectories thats the issue.

If you are trying to find the sizes of each directory in directoryies 2006*, then this will do it:

find 2006*/* -prune -type d | xargs du -sk

That will give you the size of directories under 2006* and all their sub-directories.

Another possibility might be:

echo 2006*/* | xargs du -sk

for files and directories.


If that's not what you are trying to do, what are you trying to do?