From: <[EMAIL PROTECTED]> > Is there anyway to find out "Free Disk Space" in Windows using PERL? > Assume I have a function say GetFreeDiskSpace(). I can specify some > path as a parameter to GetFreeDiskSpace() and want to get the return > value in bytes for available disk. The path can contain "Local Drive > Name" or "Share Name" or "Shared IP Address".
use Win32::FileOp qw(GetDiskFreeSpace); # c:\> ppm install Win32::FileOp my $freeSpaceOnC = GetDiskFreeSpace( 'c:'); my $freeSpaceOnShare = GetDiskFreeSpace( '\\\\server\share'); # these numbers would respect the user's quota! If you want to get the total amout of (free) space you just use this function in list context: ($freeSpaceForUser, $totalSize, $totalFreeSpace) = GetDiskFreeSpace $path; > Further enhancement to this can be, I pass second parameter to it for > specifying the how the return value should be i.e. "Bytes" or "Kilo > Bytes" or "Mega Bytes" etc. Sorry you have to do this yourself. The function above tells you the number of bytes. HTH, Jenda ===== [EMAIL PROTECTED] === http://Jenda.Krynicky.cz ===== When it comes to wine, women and song, wizards are allowed to get drunk and croon as much as they like. -- Terry Pratchett in Sourcery -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>