unless you want to recurse the tree this will do it,

unless(opendir local $TMP,$ARGV[0] ){
 print "-------------invalid directory-------------\n";
 print "USAGE:\n\t\t$0 directory to parse";
 exit 1;
}

chomp (@FILES=`dir /s /b $ARGV[0]`);

for ( @FILES ){

( $Size+= (stat $_)[7] );

}

print "TOTAL SIZE: $Size bytes \n";


----- Original Message -----
From: "Rajendra Babu, Praveen" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, December 29, 2002 7:07 PM
Subject: Directory and its sub-directory disk usage: Windows '98


> Hi All,
>       This is in Windows '98. I am writing a script to find the entire
> directory space(i.e. including sub-directories) occupied from an input
> directory name.
>
> Eg. If at the command prompt  I give something like, "perl dir_size.pl
> h:\raps\test\prajendr", the output should be the entire disk space
occupied
> by the directory "prajendr" and all its sub-directories. The one least
> option I am looking at is "dir /s" and re-directing it to a file and then
> manipulating the same.
>
>   Is there a better way in Windows ?!
>
> TIA,
> Praveen
>
>
> IMPORTANT-
> (1) The contents of this email and its attachments are confidential and
> intended only for the individual or entity named above. Any unauthorised
> use of the contents is expressly prohibited.  If you receive this email
> in error, please contact us, then delete the email.
> (2) ACNielsen collects personal information to provide and market our
> services. For more information about use, disclosure and access see our
> privacy policy at <www.acnielsen.com.au> or contact us on
[EMAIL PROTECTED]
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to