Drive.GetSize

number Drive.GetSize ( 

string Drive )

Example 1

drive_size = Drive.GetSize("C:\\");

Gets the size of the user's "C:\" drive and stores the result in a variable called "drive_size."

Example 2

how_big = Drive.GetSize(His_Drive);

Takes the variable "His_Drive" that contains a path with a drive letter and stores the drive's size in how_big.

Example 3

--Specify which drive will be checked
sDrive = "C:";

--Get total size of user's C drive:
nTotalSize = Drive.GetSize(sDrive);

-- Determine if an error occurred.
error = Application.GetLastError();
if (error ~= 0) then
    Dialog.Message("Error", _tblErrorMessages[error], MB_OK, MB_ICONEXCLAMATION, MB_DEFBUTTON1);
else
    --Get the used space
    nUsedSpace = Drive.GetUsedSpace(sDrive);
    -- Determine if an error occurred.
    error = Application.GetLastError();
    if (error ~= 0) then
        Dialog.Message("Error", _tblErrorMessages[error], MB_OK, MB_ICONEXCLAMATION, MB_DEFBUTTON1);
    else
        -- Calculate the drive percentage used, and round up
        nPercentageUsed = (nUsedSpace / nTotalSize) * 100;
        nPercentageUsed = Math.Ceil(nPercentageUsed);
  
        -- Output percentage to the user
        Dialog.Message("","Your drive is "..nPercentageUsed.."% full.");
    end
end

This example determines what percentage of the user's C: drive is currently full of data.

See also:  Related Actions