[wplug] disk usage
Moshe Hyzon
mokatz at gmail.com
Tue Apr 1 06:10:19 EST 2008
Dirs only:
find /path/to/base/folder -type d | xargs | du -s -bM | sort -nr
Files only:
find /path/to/base/folder -type f | xargs | du -s -bM | sort -nr
Moshe
On Mon, Mar 31, 2008 at 5:52 PM, Zach <netrek at gmail.com> wrote:
> I am looking for a recursive script (SH/BASH/Perl) which will show the
> total size (in MB) of each all subdirectories in a given directory. I
> would like this sorted with the largest ones listed at the top. Also a
> second script to show the largest files (also in MB and sorted with
> biggest at the top) and show which directory it is in.
>
> First script:
>
> $test> ls
>
> test1/ test2/ test3/
>
> $test3> ls
>
> testsub/
>
> First script would produce something like:
> 30MB test3/
> 20MB test2/
> 10MB test1/
> 5MB test3/testsub/
>
> $test1> ls
>
> -rw------- 1 ubuntu ubuntu 20468 2008-03-29 21:17 foo
>
> $test2> ls
>
> -rw------- 1 ubuntu ubuntu 10231 2008-03-29 20:03 bar
>
> $test3/testsub> ls
>
> -rw------- 1 ubuntu ubuntu 5303 2008-03-29 21:17 baz
>
>
> And the second script would produce:
>
> 20MB test1/foo
> 10MB test2/bar
> 5MB test3/testsub/baz
>
> Zach
> _______________________________________________
> wplug mailing list
> wplug at wplug.org
> http://www.wplug.org/mailman/listinfo/wplug
>
More information about the wplug
mailing list