Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: Determine volume size on Windows

by meetraz (Hermit)
on Jun 16, 2004 at 00:29 UTC ( [id://367091]=note: print w/replies, xml ) Need Help??


in reply to Determine volume size on Windows

I recommend the Win32::DirSize module, by yours truly. It was written to calculate directory sizes, but handles whole drives as well. Here's a sample:

use strict; use Win32::DirSize; my $DiskInfo; # this stores the disk information my $Result = disk_space( "C:", $DiskInfo, ); if ($Result == DS_RESULT_OK) { my ($DiskSizeUnit, $DiskFreeUnit, $QuotaFreeUnit); my ($ConvDiskDize, $ConvDiskFree, $ConvQuotaFree); $ConvDiskDize = best_convert( $DiskSizeUnit, $DiskInfo->{HighTotalBytes}, $DiskInfo->{LowTotalBytes}, ); $ConvDiskFree = best_convert( $DiskFreeUnit, $DiskInfo->{HighFreeBytes}, $DiskInfo->{LowFreeBytes}, ); $ConvQuotaFree = best_convert( $QuotaFreeUnit, $DiskInfo->{HighQuotaBytes}, $DiskInfo->{LowQuotaBytes}, ); print "Disk Size = $ConvDiskDize $DiskSizeUnit \n"; print "Disk Free = $ConvDiskFree $DiskFreeUnit \n"; print "Quota Free = $ConvQuotaFree $QuotaFreeUnit \n"; }

Replies are listed 'Best First'.
A reply falls below the community's threshold of quality. You may see it by logging in.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://367091]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (None)
    As of 2024-04-25 04:23 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      No recent polls found