Folder Object (VB6)

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 file system to extract other Folder objects and other Folders collections. A Boolean property, IsRootFolder, informs you whether or not the Folder object you are dealing with currently is the root of the Drive or not.

The Folder 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.

Createable

No

Returned by

Drive.RootFolder Property, Folder.SubFolders.Item Property

Properties

Attributes

Data Type: FileAttributes constant

A set of flags representing the folder's attributes. You can determine which flag is set by using logical AND along with the value returned by the property and the value of the constant you'd like to test. For example:

If oFolder.Attributes ...

Get VB & VBA in a Nutshell: The Language 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.