当前位置: 首页 > 网络学院 > 服务端脚本教程 > ASP > ASP Folder
The Folder Object is used to return information about a specified folder.
Folder(文件夹)对象是用来返回指定的文件夹信息的
The Folder object is used to return information about a specified folder.
Folder(文件夹)对象是用来返回指定的文件夹信息的
To work with the properties and methods of the Folder object, you will have 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.
通过运用文件夹对象的属性和方法,首先,你必须通过FileSystemObject对象建立一个文件夹对象的实体;通过FileSystemObject对象的GetFolder方法或通过文件对象的Files属性建立一个FileSystemObject对象以及列出一个文件夹的对象。
The following code uses the GetFolder method of the FileSystemObject object to instantiate the Folder object and the DateCreated property to return the date when the specified folder was created:
下面的代码通过使用FileSystemObject对象的GetFolder用法列出了文件夹对象,通过使用DateCreated属性返回了指定文件夹被创立的时间。
<% 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 |
The Folder object's collections, properties, and methods are described below:
Folder对象的集合、属性和用法如下表列出:
Collection 集合 | Description 描述 |
---|---|
Files | Returns a collection of all the files in a specified folder 返回指定文件夹中所有文件的集合 |
SubFolders | Returns a collection of all subfolders in a specified folder 返回指定文件夹中的二级文件夹集合 |
Property 属性 | Description 描述 |
---|---|
Attributes | Sets or returns the attributes of a specified folder 设置或返回指定文件夹的属性 |
DateCreated | Returns the date and time when a specified folder was created 返回指定文件夹建立的日期和时间 |
DateLastAccessed | Returns the date and time when a specified folder was last accessed 返回指定文件夹最后被访问的日期和时间 |
DateLastModified | Returns the date and time when a specified folder was last modified 返回指定文件夹最后被修改的日期和时间 |
Drive | Returns the drive letter of the drive where the specified folder resides 返回指定文件夹所处的盘符的盘符号 |
IsRootFolder | Returns true if a folder is the root folder and false if not 检查一个文件夹是否为根文件夹,是(“true”);否(“False”) |
Name | Sets or returns the name of a specified folder 设置或返回指定文件夹的名字 |
ParentFolder | Returns the parent folder of a specified folder 返回指定文件的父文件夹 |
Path | Returns the path for a specified folder 返回一个指定文件夹的路径 |
ShortName | Returns the short name of a specified folder (the 8.3 naming convention) 返回一个指定文件夹的短名 (根据8.3 命名规则) |
ShortPath | Returns the short path of a specified folder (the 8.3 naming convention) 返回一个指定文件夹的短路径 (根据8.3 命名规则) |
Size | Returns the size of a specified folder 返回指定文件夹所包含的字节数大小 |
Type | Returns the type of a specified folder 返回指定文件夹的类型 |
Method 方法 | Description 描述 |
---|---|
Copy | Copies a specified folder from one location to another 将本机上的文件夹复制到异地机子上 |
Delete | Deletes a specified folder 删除指定文件夹 |
Move | Moves a specified folder from one location to another 将本机上的文件夹移动到异地机子上 |
CreateTextFile | Creates a new text file in the specified folder and returns a TextStream object to access the file 在指定文件夹中建立一个新的文本文件并返回一个TextStream对象 |