Get information on your hard drive using Perl

I want to use perl to check the hard disk space on Windows , is there a way to do this?

Regards,

+5
source share
4 answers

see Win32 :: DriveInfo

($SectorsPerCluster, $BytesPerSector, $NumberOfFreeClusters, $TotalNumberOfClusters, $FreeBytesAvailableToCaller, $TotalNumberOfBytes, $TotalNumberOfFreeBytes) = Win32::DriveInfo::DriveSpace( drive ); $SectorsPerCluster - number of sectors per cluster. $BytesPerSector - number of bytes per sector. $NumberOfFreeClusters - total number of free clusters on the disk. $TotalNumberOfClusters - total number of clusters on the disk. $FreeBytesAvailableToCaller - total number of free bytes on the disk that are available to the user associated with the calling thread, b. $TotalNumberOfBytes - total number of bytes on the disk, b. $TotalNumberOfFreeBytes - total number of free bytes on the disk, b. 
+6
source

In most cases, portable solutions like Filesys::DfPortable are the best choice. Recognize the possibility of being masterfully lazy .

+8
source

Win32 driver information should do the trick.
I think you are looking

$ TotalNumberOfFreeBytes

+1
source

Another way to query system status is to query the Windows Management Interface using DBD :: WMI .

The following query should provide you with basic information about disk storage:

 Select DeviceID,Size,FreeSpace from Win32_LogicalDisk 
0
source

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


All Articles