Page 1 of 1

GetFreeDiscSpace

Posted: Sun Sep 14, 2003 1:15 pm
by GPI
Code updated for 5.20+

Code: Select all

Procedure.s GetFreeSpace(drive.s)
  If GetDiskFreeSpaceEx_(@drive, @FB.q, @TB.q, @TFB.q)
    Define f.f, freeSpace.s
    If TFB => 1099511627776
      f = TFB / 1099511627776
      freeSpace = StrF(f, 3) + " TB"
    ElseIf TFB => 1073741824
      f = TFB / 1073741824
      freeSpace = StrF(f, 3) + " GB"
    ElseIf TFB => 1048576
      f = TFB / 1048576
      freeSpace = StrF(f, 3) + " MB"
    ElseIf TFB => 1024
      f = TFB / 1024
      freeSpace = StrF(f, 3) + " KB"
    Else
      freeSpace = StrF(TFB, 3) + " bytes"
    EndIf
  EndIf
  ProcedureReturn freeSpace
EndProcedure

Debug GetFreeSpace("c:\")

Posted: Sun Sep 14, 2003 5:49 pm
by blueb
Very nice GPI..... thanks 8)

I had to rename it to: GetFreeDriveSpace(p$) because GetFreeSpace already exists in WinAPI.

--blueb

Posted: Sun Mar 07, 2004 7:04 pm
by dagcrack
Thx for sharing, but hey it isnt acurate! :S

Posted: Sun Mar 07, 2004 9:15 pm
by TronDoc
for windows only :?:
Linux:
Line 24: GetDiskFreeSpaceEx_() is not a function, an array, or a linked list

Posted: Sun Mar 07, 2004 11:24 pm
by Andre
TronDoc wrote:for windows only :?:
Linux:
Line 24: GetDiskFreeSpaceEx_() is not a function, an array, or a linked list
Its a function from the Windows API, so you are right.

Posted: Mon Mar 08, 2004 3:25 pm
by blueb
Dagcrack - Thx for sharing, but hey it isnt acurate!
dagcrack,

Reloaded and checked. Accurate :)

Using WinXP Pro

blueb

Posted: Tue Mar 16, 2004 9:42 am
by dagcrack
No, shows less than I really have.

Posted: Tue Mar 16, 2004 7:49 pm
by GPI
dagcrack wrote:No, shows less than I really have.
What exact is shown and what do you really have.

Maybe a round-error. btw: Funny: Some Windows-Windows show, that a file has 26 KB, other that the file has 25 KB...

Posted: Tue Mar 16, 2004 11:30 pm
by dagcrack
I trust in TC 8)

Posted: Wed Mar 17, 2004 7:36 pm
by GPI
dagcrack wrote:I trust in TC 8)
?!

Posted: Thu Mar 18, 2004 12:27 pm
by dagcrack
Oouoh... TC = TotalCommander