The ASP Folder object is used to access a specified file folder on the web server. As with other objects, the Folder object has properties and methods to help you traverse the directories on the drive, and to get to the target directory of interest, so you can access all the properties of the folder.

To access a target folder, you first need to create an instance of the FileSystemObject object and then instantiate the Folder object through the GetFolder method.

Properties

Methods

Examples

In the following example, we will create an instance of the FileSystemObject object and then use the GetFolder method to instantiate the Folder object. Finally, we use the Folder object properties to get the information about the specified Folder. The second example shows how to delete a folder.

<% Dim objFSO, objDrive Set objFSO = Server.CreateObject(“Scripting.FileSystemObject”) Set objFolder = objFSO.GetFolder(“c:\temp”) Response.Write(“Name: " & objFolder.Name & “
”) Response.Write(“ShortName: " & objFolder.ShortName & “
”) Response.Write(“Size: " & objFolder.Size & " bytes
”) Response.Write(“Type: " & objFolder.Type & “
”) Response.Write(“Path: " & objFolder.Path & “
”) Response.Write(“ParentFolder: " & objFolder.ParentFolder & “
”) Response.Write(“ShortPath: " & objFolder.ShortPath & “
”) Response.Write(“DateCreated: " & objFolder.DateCreated & “
”) Response.Write(“DateLastAccessed: " & objFolder.DateLastAccessed & “
”) Response.Write(“DateLastModified: " & objFolder.DateLastModified) %>

<% Dim objFSO,objFolder Set objFSO=Server.CreateObject(“Scripting.FileSystemObject”) Set objFolder=objFSO.GetFolder(“c:\temp) objFolder.Delete Set objFolder=nothing Set objFSO=nothing %>