I need to get the free disk space, total disk space in windows machine using perl.
For an example,
use strict;
my $curr_drive="c:\";
From the above code, I want to get the c:\ drive free space and total space. I have tried with Filesys::DiskSpace module. But I dont how to proceed the module for windows. Please share your solutions.
Thanks
The module Filesys::DiskSpace is unsupported on Windows. You have to use Win32::DriveInfo.
Try the following:
use strict;
use warnings;
use Win32::DriveInfo;
my (undef, undef, undef, undef, undef, $total, $free) =
Win32::DriveInfo::DriveSpace('c');
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With