Mailing List Archive
tlug.jp Mailing List tlug archive tlug Mailing List Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]Re: [tlug] Command to find directories containing a particular size of data
- Date: Sun, 3 Apr 2011 16:38:42 +0900
- From: Mattia Dongili <malattia@example.com>
- Subject: Re: [tlug] Command to find directories containing a particular size of data
- References: <4D97EA2A.7080807@example.com> <20110403064729.GA4552@example.com>
- User-agent: Mutt/1.5.21 (2010-09-15)
On Sun, Apr 03, 2011 at 08:47:29AM +0200, Christian Horn wrote: > On Sun, Apr 03, 2011 at 12:31:54PM +0900, Dave M G wrote: > > > > However, what I'd really like is a sort of combination of the two. I > > want to crawl through a whole directory tree, and find the directories > > that contain 10MB or more of files. > > > > When calculating the size of any one directory, I need to know just the > > total size of *files* in that directory, but not including the sizes of > > subdirectories in that total. > > # bash, prints directories with >=5mb size > for i in $(find /etc/ -type d); do > if [ $(du -sm $i|awk '{print $1}') -ge 5 ]; then > du -sm $i; > fi; > done you save a number of forks and dus like this: $ find ~/devel/linux-sony-2.6/ -type d -print0 | xargs -0 du -sS | \ awk '$1 > 10000 { printf "%s (%d)\n", $2, $1 }' Also note the -S to du: "do not include size of subdirectories". -- mattia :wq!
- References:
- [tlug] Command to find directories containing a particular size of data
- From: Dave M G
- Re: [tlug] Command to find directories containing a particular size of data
- From: Christian Horn
Home | Main Index | Thread Index
- Prev by Date: Re: [tlug] Command to find directories containing a particular size of data
- Next by Date: Re: [tlug] UPS batteries
- Previous by thread: Re: [tlug] Command to find directories containing a particular size of data
- Next by thread: Re: [tlug] git and sub-directories
- Index(es):
Home Page Mailing List Linux and Japan TLUG Members Links