Free Disk Space Unit Size?

Hi,
The code below works perfectly.

Could someone please tell me what unit the totalfree is measured in?
I am presuming it is Kilobytes? If it is in Bytes, could someone please tell me how many Bytes in 20Mb (is it 20971520) ?

[code] Declare Function GetDiskFreeSpaceExW Lib “Kernel32” (dirname As WString, ByRef freeBytesAvailable As UInt64, _
ByRef totalbytes As UInt64, ByRef totalFreeBytes As UInt64) As Integer
Dim userfree, totalsize, totalfree As UInt64
Call GetDiskFreeSpaceExW(App.ExecutableFile.Parent.AbsolutePath, userfree, totalsize, totalfree)

if totalfree < 20480 then
MsgBox(“This drive appears to have less than 20Mb of free space available!”)
end if[/code]

Thank you all in advance.

GetDiskFreeSpaceEx returns bytes. 20MB would be 1024 * 1024 * 20 = 20971520

Wow - I was right ! :slight_smile:

Thank you.

Beware: on some OS, the displayed value use 1,000Bytes as 1KB (and not 1,024Bytes).

And I do not talk about real size (in Bytes) / logical size (on the hard disk 512 or 1024 or… cluster size).