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



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

Christian


Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links