How to find disk space using Perl in a Windows machine?

I need to get free disk space, total disk space in a windows machine using perl.

As an example,

use strict; my $curr_drive="c:\"; 

From the above code I want to get free space and total space for c: \ drive. I tried with Filesys :: DiskSpace. But I am not going to work with the module for windows. Please share your solutions.

thanks

+4
source share
2 answers

Filesys :: DiskSpace is not supported on Windows. You must 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'); 
+4
source

I believe CPAN has your answer: DriveInfo

+2
source

Source: https://habr.com/ru/post/1396852/


All Articles