ASP Folder
The Folder object is used to return information about the specified folder.
Folder Object
The Folder object is used to return information about the specified folder.
To operate the related properties and methods of the Folder object, you need to create an instance of the Folder object through the FileSystemObject object. First, create a FileSystemObject object, and then instantiate the Folder object through the GetFolder method of the FileSystemObject object.
The following code uses the GetFolder method of the FileSystemObject object to instantiate the Folder object, and uses the DateCreated property to return the creation date of the specified folder:
<%
Dim fs,fo
Set fs=Server.CreateObject("Scripting.FileSystemObject")
Set fo=fs.GetFolder("c:\test")
Response.Write("Folder created: " & fo .DateCreated)
set fo=nothing
set fs=nothing
%>
Output:
Folder created: 10/22/2008 10:01:19 AM
Dim fs,fo
Set fs=Server.CreateObject("Scripting.FileSystemObject")
Set fo=fs.GetFolder("c:\test")
Response.Write("Folder created: " & fo .DateCreated)
set fo=nothing
set fs=nothing
%>
Output:
Folder created: 10/22/2008 10:01:19 AM
The collection, properties and methods of the Folder object are described as follows:
Collection
Collection | Description |
---|---|
Files | Returns a collection of all files in the specified folder. |
SubFolders | Returns the collection of all subfolders in the specified folder. |
Attributes
Attributes | Description |
---|---|
Attributes | Sets or returns the specified Properties of the folder. |
DateCreated | Returns the date and time the specified folder was created. |
DateLastAccessed | Returns the date and time the specified folder was last accessed. |
DateLastModified | Returns the date and time the specified folder was last modified. |
Drive | Returns the drive letter of the drive where the specified folder is located. |
IsRootFolder | Returns true if the folder is the root folder, false otherwise. |
Name | Set or return the name of the specified folder. |
ParentFolder | Returns the parent folder of the specified folder. |
Path | Returns the path to the specified folder. |
ShortName | Returns the short name of the specified folder (8.3 naming convention). |
ShortPath | Returns the short path (8.3 naming convention) of the specified folder. |
Size | Returns the size of the specified folder. |
Type | Returns the type of the specified folder. |
Method
Method | Description |
---|---|
Copy | Copy the specified folder from one location to another. |
Delete | Delete the specified folder. |
Move | Move the specified folder from one location to another. |
CreateTextFile | Creates a new text file in the specified folder and returns a TextStream object to access this file. |