GetFreeSpace

Public Function GetFreeSpace(ByVal Drivename As String, Optional ByVal BytesTotal As LongLong) As LongLong

Returns the number of free bytes on the specified disk. Returns -1 if drive is not found or not ready.

Dim lDiskName As String
For Each lDiskName In {"C", "D", "E", "F"}
   Dim lTotalBytes As LongLong
   Dim lBytesFree As LongLong = GetFreeSpace($"{lDiskName}:\", lTotalBytes)
   
   SendDebug $"Disk {lDiskName}:\ has {lBytesFree} bytes free on a total of {lTotalBytes}. That equals {IIf(lTotalBytes > 0, Round((lBytesFree / lTotalBytes) * 100, 2), "--")}%"
Next