It is currently Sat, 04 Dec 2021 18:30:08 GMT

Author Message
 Directory search for disk totals
I'm trying to find a way to search through all directories on a given
host to find alloccurrences of a business unit's files so as to know
how much space any given business unit is using.  For example, the
business units'names are of the form "d36hph".  I can "ls -lR" from /
and grep for "36hph" and "grep -v" out the  "./" and "../" to get a
list and then awk out the size and use awk to do the totaling.  Anybody
know a better way of doing this?  I thought about using "du", but am
not sure how I would feed the business acronym other than to have a
list to cat through in a for loop.  It doesn't seem to make much sense
to make a list and then process that if I can do it on the fly and
process only once.

Ideas anyone?  Am I just being thick-headed? ;-)

-- John

Sent via

 Sun, 20 Jul 2003 01:05:43 GMT   
 Directory search for disk totals

man quota

 Sun, 20 Jul 2003 06:19:43 GMT   
 Directory search for disk totals

Don't know if you identify you bussiness units by username or group but find
accepts both -user and -group.

   find /  -user d36hph -exec ls -s {} \; | grep '^[0-9]' | awk '{sum += $1}
END {print sum}'

This will find all files of user d36hph, list the size in the 1st column and
add it all up. Should work but test it first.


 Sun, 20 Jul 2003 18:00:21 GMT   
 Directory search for disk totals
In article <>,
  "Bill Marcum" <> wrote:
We don't run quotas here.

-- John

Sent via

 Tue, 22 Jul 2003 06:37:59 GMT   
   [ 4 post ] 

Similar Threads

1. find files in one directory to use to search through another directory

2. How to recursively search through directories in a giving directory

3. How to get the number off files named *.cpp in a directory and the total size

4. Finding total size of files in directory tree?

5. Looking for utility to show total size of files in directory

6. Total space used by directory

7. total bytes in a directory

8. total, total newbie needs help with general unix

9. Installing a new disk without total reinstallation?

10. How to find out the total disk space

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software