docs

Home All functions Categories

vuGetDriveSpace(tDir, FormatType)

vuGetDriveSpace(*CSTRING,LONG), CSTRING

Description

Retrieves free and total space for a specified drive and returns the result as a formatted string.
Supports multiple output formats including raw bytes, comma-separated, gigabytes, and hybrid format.

Parameters

Parameter Data Type Description
tDir CSTRING(128) Root path of the drive (for example, C:\).
FormatType LONG Format for returned string:
0 = Raw bytes
1 = Comma separated
2 = GB
3 = Hybrid

Note: In vuFileTools V5, CSTRINGs are not limited to the size shown above. The number is for example only.

Returns

A CSTRING containing the free and total space in the format specified.

Example

sRootPath CSTRING(4)
sRaw      CSTRING(128)
sComma    CSTRING(128)
sGB       CSTRING(128)
sHybrid   CSTRING(128)
sMsg      STRING(512)

  CODE
  sRootPath = 'C:\'

  sRaw     = vuGetDriveSpace(sRootPath, 0)
  sComma   = vuGetDriveSpace(sRootPath, 1)
  sGB      = vuGetDriveSpace(sRootPath, 2)
  sHybrid  = vuGetDriveSpace(sRootPath, 3)

  sMsg = 'Drive space (Free / Total) for ' & CLIP(sRootPath) & ':' & '<13,10>' & |
         'Raw:     ' & CLIP(sRaw) & '<13,10>' & |
         'Comma:   ' & CLIP(sComma) & '<13,10>' & |
         'GB:      ' & CLIP(sGB) & '<13,10>' & |
         'Hybrid:  ' & CLIP(sHybrid)

  MESSAGE(sMsg, 'vuGetDriveSpace Formats')

Notes

The raw format provides values in bytes separated by /.

GB format rounds values to gigabytes with suffix.

Hybrid format shows both GB and raw bytes.

Works with local, removable, and network drives.

Home All functions Categories