i am writing a script that does a number os usage and space checking routines. having trouble with one of them. the plan here is to recurse thru a directory, record each uniqe user and add the size of the directories per user and then spit out a total like this:
User Total usage in /some/dir foo 450MB bar 550MB here is some code: ---------- use File::Find; find (\&wanted_user, "$dir"); sub wanted_user { %sum = (); next unless (-d $_); ($user,$size) = (stat($_))[4,7] or die "can't stat: $!\n"; push ( @{$sum{$user}}, $size ); } foreach $user (sort keys %sum) { print "$user: @{$sum{$user}}\n"; } ---------------- questions: 1. it prints nothing. it should at least print something like 11847: 44645, 45466.... 2. after question 1 is solved, what is the best way to add the size into a total. something like: push ( @{$sum{$user}}, ++$size ); ? 3. also I may have to get rid of the stat() way of getting the user and size because there are some dirs that have dirs and files that i do not have access too and will generate erros instead of stating. i know i can parse a `ls -ld` but is there a better way? Thanks for any help Jim -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]