Syntax:
[int] sysinfo.drivefree(String drivename)
Description:
The drivefree method can be used to detect the space available for memory storage on a device.
Argument:
drivename:
Specifies the name of a drive to be examined.
Return value:
If the drive exists, this method returns an integer value indicating the available space on the specified drive, measured in bytes.
Example code:
function checkDrivesInformation() {
var space = 0;
// get existing user's drives
var allDrives = sysinfo.drivelist;
var drives = allDrives.split(" ");
// read and print all drives’ name and information
for (var i=0; i<drives.length; i++) {
space = sysinfo.drivesize(drives[i]);
space /=1024; // convert from bytes to kB
alert("Total space of drive "+drives[i]+" ="+space+"kB";
space = sysinfo.drivefree(drives[i]);
space /=1024; // convert from bytes to kB
alert("Free space of drive "+drives[i]+" ="+space+"kB";
}
}