Drive.RootFolder

JScript3.0+Syntax

							driveobject.RootFolder

Description

The RootFolder property of the Drive object contains a Folder object that represents the root folder of the specified drive.

Example

Listing 9.33 provides a function that returns the root folder of drive C.

Listing 9.33 Return the Root Folder
function getCRootFolder()
{
  //Create a string to hold the drive path
  var drivePath = "C:";

  //Create a file system object
  var fileSysObj = new ActiveXObject("Scripting.FileSystemObject");

  //Create a Drive object for drive C
  var drive = fileSysObj.GetDrive(fileSysObj.GetDriveName(drivePath));

  //Return root folder object for drive C
  return(drive.RootFolder);
}
						

Get Pure JavaScript now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.