Name
Folders Collection Object
Creatable
No
Returned by
Folder.SubFolders property
Library
Microsoft Scripting Runtime
Description
The Folders collection object is a container for Folder objects. Normally, you’d expect to access a single object from the collection of that object; for example, you’d expect to access a Folder object from the Folders collection object. However, things are the other way around here: you access the Folders collection object from an instance of a Folder object. This is because the first Folder object you instantiate from the Drive object is a Root Folder object, and from it you instantiate a subfolders collection. You can then instantiate other Folder and subfolder objects to navigate through the drive’s filesystem.
The Folders collection is a subfolder of any Folder object. For instance, the top-level Folders collection (representing all of the folders in the root directory of a particular drive) can be can be instantiated as follows:
Dim oFS, oFolders
Set oFS = WScript.CreateObject("Scripting.FileSystemObject")
Set oFolders = oFS.Drives("C").RootFolder.SubFoldersThe Folders collection object is one of the objects in the File System object model; see the File System object model entry for an overview of the model, including the library reference needed to access it.
Properties
- Item
Data Subtype: Folder object
Retrieves a particular Folder object from the Folders collection object. You can access an individual folder object by providing the exact name of the folder ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access