OverviewExamples
Used_Space = Drive.GetUsedSpace("C:\\");
Gets the used disk space on the user's "C:\" drive and stores the result in a variable called "Used_Space."
how_much = Drive.GetUsedSpace(Read_Drive);
Takes the variable "Read_Drive" that contains a path with a drive letter and stores the used disk space value in how_much.
--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