November 22, 2000 - Probing Drives | WebReference

November 22, 2000 - Probing Drives

Yehuda Shiran November 22, 2000
Probing Drives
Tips: November 2000

Yehuda Shiran, Ph.D.
Doc JavaScript

You can use JavaScript to get a lot of information about the drives in your system, both disk drives as well shared networks. A drive object is created using the GetDrive() method of the FileSystemObject object. The syntax is as follows:

GetDrive(letterDrive);
The single parameter, letterDrive, is the given drive name. This method returns the drive object. The following script should create a drive object for f:

<SCRIPT LANGUAGE="JavaScript">
<!--
var fso = new ActiveXObject("Scripting.FileSystemObject");
driveObj = fso.GetDrive("f");
-->
</SCRIPT>
The drive object does not have any methods. Here are the drive object's properties:
PropertyDescription
AvailableSpaceReturns the number of free bytes on the given drive
DriveLetterReturns the drive letter of a physical local drive or a shared network
DriveTypeReturns the drive type
FileSystemReturns the file system type for the specified drive
FreeSpaceReturns the number of free bytes on the given drive
IsReadyReturns the status of the drive
PathReturns the path of the given drive
RootFolderReturns the folder object of the root folder
SerialNumberReturns the unique serial number of the volume
ShareNameReturns the shared name of a network drive
TotalSizeReturns the total number of bytes on a specified drive
VolumeNameSets or returns the volume name of the specified drive