drivefree()

Syntax:

[int] sysinfo.drivefree(String drivename)

Description:

The drivefree method can be used to detect the available space of an existing memory storage in a device.

Argument:

Return value:

If the drive exists, this method returns an integer value indicating the available space of 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";
     }
  }