Gentoo Archives: gentoo-user

From: Richard Fish <bigfish@××××××××××.org>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Listing directories with size greater than...
Date: Fri, 22 Jul 2005 15:19:18
Message-Id: 42E10E1F.7080809@asmallpond.org
In Reply to: RE: [gentoo-user] Listing directories with size greater than... by Dave Nebinger
1 Dave Nebinger wrote:
2
3 >>I need some help with listing home directories that are greater than i
4 >>given size. I have tried
5 >>find /home -type d -size +50000k
6 >>and
7 >>find /home -type d -size +50000k -iname "*"
8 >>Both without much success...
9 >>
10 >>
11 >
12 >find will not calculate folder sizes (as you've already seen).
13 >
14 >You'll need to use du and then filter the output. Perchance something like:
15 >
16 > du | grep -v "\/" | sort -n
17 >
18 >This should give you the directories (in the current dir) w/o the sub
19 >directories but include the calculated size of the directory sorted
20 >numerically on the output.
21 >
22 >
23 >
24
25 You can do something similar with a pair of recursive du:
26
27 du -S ./ | grep -E "^[5-9][0-9]{4}[^0-9]"
28 du -S ./ | grep -E "^[0-9]{6,}"
29
30 The first command will give you a listing of all directories with
31 50000-99999k of files. The second gives you all directories with
32 100000k+ of files. Neither size includes subdirectories, so if you want
33 sub-directories included in the math, just take out the '-S' option.
34
35 -Richard
36
37
38 --
39 gentoo-user@g.o mailing list