Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!henry From: henry@utzoo.UUCP (Henry Spencer) Newsgroups: alt.sources Subject: Re: Short 'n' dirty file space totaller Message-ID: <8738@utzoo.UUCP> Date: Sat, 10-Oct-87 18:38:28 EDT Article-I.D.: utzoo.8738 Posted: Sat Oct 10 18:38:28 1987 Date-Received: Sat, 10-Oct-87 18:38:28 EDT References: <239@ddsw1.UUCP> Organization: U of Toronto Zoology Lines: 19 Keywords: Microport (or is it system V) disk utility > Here's a real short, cheap-n-dirty disk usage tracker. [40 lines of C] Um, did you consider: du -s `awk -F: '{print $6}' /etc/passwd` | sed 's;.*/;;' (Three assumptions: your du has the -s option [I've never heard of one that doesn't], the home directory is the sixth field in /etc/passwd, and the home directories have names corresponding to the users. Failures in these assumptions can generally be bypassed by making it a bit fancier.) This works just as well. (Subject to the flaw that's common to any du-based disk accounting, to wit updating the accessed-time on all directories.) In general, if you find yourself writing a C program whose main job is to invoke other programs, you should probably try to do it as a shell program first. -- "Mir" means "peace", as in | Henry Spencer @ U of Toronto Zoology "the war is over; we've won". | {allegra,ihnp4,decvax,utai}!utzoo!henry