How do I find out how much disk space is occupied?

Use the function GetDiskFreeSpace. The declaration for this API function is:

Declare Function GetDiskFreeSpace Lib "kernel32" Alias _
"GetDiskFreeSpaceA" (ByVal lpRootPathName As String, _
lpSectorsPerCluster As Long, lpBytesPerSector As Long, _
lpNumberOfFreeClusters As Long, lpTotalNumberOfClusters _
As Long) As Long

Here is an example of how to find out how much free space a drive has:

Dim SectorsPerCluster&
Dim BytesPerSector&
Dim NumberOfFreeClusters&
Dim TotalNumberOfClusters&
Dim FreeBytes&
dummy& = GetDiskFreeSpace("c:\", SectorsPerCluster, _
BytesPerSector, NumberOfFreeClusters, TotalNumberOfClusters)
FreeBytes = NumberOfFreeClusters * SectorsPerCluster * _
BytesPerSector

The Long FreeBytes contains the number of free bytes on the drive.


Rob Test | Venetian Blinds | Relocate Reliance | Celebrity Pictorials & Gossip | Employer Benefit Programs