Hey guys, I was working on a disk usage script. Mainly using stat like DAn had in an earlier posting. Buit when I saw Janek post I thought, "That's perfect, Just what I was doing but about 8 lines less." I incorporated it into my script but the waring message I can't figure out. I am kinda new, but thanks for the help...
<--snip--> use strict; use diagnostics; $|++; use File::Find; use vars qw (@users $user $BLOCK_SIZE $TOTAL_SIZE $MB_SIZE); @ARGV = ('/home') unless @ARGV; $TOTAL_SIZE = 0; $MB_SIZE= 0; opendir(DIRECTORY, "@ARGV") || die $!; @users = readdir(DIRECTORY); closedir(DIRECTORY); foreach $user (@users) { next if ($user eq ".") || ($user eq "..") ; find(sub {$TOTAL_SIZE += -s if -f}, "$user"); print "$user $TOTAL_SIZE\n"; undef $TOTAL_SIZE; } <--/snip--> I had to undef $TOTAL_SIZE because it kept adding the users together and I could not figure a way to get the du individually. THe error message I am getting says something like this: Use of uninitialized value in concatenation (.) or string at /home/ckell/scripts/du.pl line 28 (#1) but if the undef is taken out the warning messag is gone but I don't get the right results. Thanks again, chad
signature.asc
Description: This is a digitally signed message part