Scripting the File System, Part I: The Drive Object - Doc JavaScript | WebReference

Scripting the File System, Part I: The Drive Object - Doc JavaScript


Scripting the File System, Part I

The Drive Object

DrivesCollection

The drives collection holds a read-only collection of all available drives in the system. It has two properties:

PropertyDescription
CountReturns the number of items in the collection
ItemSets or returns an item from the collection that matches a specified key
DriveTypeReturns the drive type
GetDrive(letterDrive)Object

This method returns the drive object of the given drive name. 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

Next: How to write a browser-independent HTML file

https://www.internet.com


Produced by Yehuda Shiran and Tomer Shiran
All Rights Reserved. Legal Notices.
Created: November 20, 2000
Revised: November 20, 2000

URL: https://www.webreference.com/js/column71/10.html