Folder Object (VB6) |
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.
No
Drive.RootFolder Property, Folder.SubFolders.Item Property
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 And ReadOnly Then ' Folder is read-only
The FileAttributes constants are:
Constant | Value |
---|---|
Alias | 64 |
Archive | 32 |
Compressed | 2048 |
Directory | 16 |
Hidden | 2 |
Normal | 0 |
ReadOnly | 1 |
System | 4 |
Volume | 8 |
Date Created
Data Type: Date
The date the folder was created.
DateLastAccessed
Data Type: Date
If available from the operating system, the date the Folder was last accessed.
DateLastModified
Data Type: Date
The date the folder was last modified.
Drive
Data Type: Drive object
Returns a Drive object representing the drive on which this folder resides.
Files
Data Type: Files collection object
Returns a Files collection object representing all files in the current folder.
IsRootFolder
Data Type: Boolean
Returns True if the folder is the root folder of its drive.
Name
Data Type: String
Returns the name of the folder.
ParentFolder
Data Type: Folder object
Returns a folder object representing the folder that's the parent of the current folder; not available if the current object is the root folder of its drive.
Path
Data Type: String
Returns the complete path of the current folder, including its drive.
ShortName
Data Type: String
Returns a DOS 8.3 folder name. May not work on an NTFS system.
ShortPath
Data Type: String
Returns a DOS 8.3 folder name. May not work on an NTFS system.
Size
Data Type: Variant
Returns the complete size of all files, subfolders, and their contents in the folder structure, starting with the current folder.
SubFolders
Data Type: Folders collection object
Returns a Folders collection object representing all subfolders within the current folder.
Type
Data Type: String
Doesn't appear to be fully implemented; always returns "File Folder."
Copy | CreateTextFile |
Delete | Move |