Objet Folder ASP

L'objet Folder est utilisé pour renvoyer des informations sur le dossier spécifié.

Folder object

The Folder object is used to return information about the specified folder.

To operate on the Folder object, we need to create an instance of the Folder object through the FileSystemObject object. First, create a FileSystemObject object, and then use the GetFolder method of the FileSystemObject object to demonstrate the Folder object.

The following code demonstrates the Folder object using the GetFolder method of the FileSystemObject object and uses the DateCreated property to return the creation date of the specified file:

<%
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/2001 10:01:19 AM

Collection of Folder objects, properties, and methods

Collection

Collection Description
Files Return the collection of all folders in the specified folder.
SubFolders Return the collection of all subfolders in the specified folder.

Properties

Properties Description
Attributes Set or return the attributes of the specified folder.
DateCreated Return the date and time when the specified folder was created.
DateLastAccessed Return the date and time when the specified folder was last accessed.
DateLastModified Return the date and time when the specified folder was last modified.
Drive Return the drive letter of the drive where the specified folder is located.
IsRootFolder If the folder is the root folder, return true, otherwise return false.
Name Set or return the name of the specified folder.
ParentFolder Return the parent folder of the specified folder.
Path Return the path of the specified file.
ShortName Return the short name of the specified folder. (8.3 Naming Convention)
ShortPath Return the short path of the specified folder. (8.3 Naming Convention)
Size Return the size of the specified folder.
Type Return the type of the specified folder.

Method

Method Description
Copy Copier le dossier spécifié d'un emplacement à un autre.
Delete Supprimer le dossier spécifié.
Move Déplacer le dossier spécifié d'un emplacement à un autre.
CreateTextFile Créer un nouveau fichier texte dans le dossier spécifié et retourner un objet TextStream pour accéder à ce fichier.