Name

Folder Object

Creatable

No

Returned by

Drive.RootFolder property
FileSystemObject.CreateFolder method
FileSystemObject.GetFolder method
Folder.SubFolders.Item property
Folders.Add method

Library

Microsoft Scripting Runtime

Description

The Folder object allows you to interrogate the system properties of the folder and provides methods that allow you to copy, move, and delete the folder. You can also create a new text file within the folder.

The Folder object is unusual, because with it, you can gain access to a Folders collection object. The more usual method is to extract a member of a collection to gain access to the individual object. However, because the Drive object exposes only a Folder object for the root folder, you have to extract a Folders collection object from a Folder object (the collection represents the subfolders of the root). From this collection, you can navigate downward through the filesystem to extract other Folder objects and other Folders collections. A Boolean property, IsRootFolder, informs you of whether the Folder object you are dealing with currently is the root of the drive.

The Folder object is one of the objects in the Filesystem object model; for an overview of the model, see the “File System Object Model” entry.

Properties

Attributes

Data Subtype: Long

A set of flags representing the folder’s attributes. The flags that apply to folders are:

Constant

Value

Archive

32

Directory

16

Hidden

2

ReadOnly

1

System

4

As the table shows, the Scripting Runtime ...

Get VBScript in a Nutshell 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.