ÄúµÄλÖãºÑ°ÃÎÍøÊ×Ò³£¾±à³ÌÀÖÔ°£¾VBScript£¾VBScript


objects constants operators statements functions properties methods







OBJECT:  Folders Collection

object.SubFolders

When using an instance of the Folder object, it's SubFolder property returns a Folders collection consisting of all the subfolders (Folder objects) in that folder.

The following code illustrates how to get a Folders collection and display it's contents in the browser.

Code:
<%
Dim filesys, demofolder, sub, folcoll, folist
Set filesys = CreateObject("Scripting.FileSystemObject") 
Set demofolder = filesys.GetFolder(folderspec) 
Set folcoll = demofolder.SubFolders  
For Each sub in folcoll
    folist = folist & sub.Name  
    folist = folist & "<BR>"  
Next
Response.Write folist
%>

METHODS

Add Method
This method is used to add a new Folder to a Folders collection.

Syntax: object.Add("foldername")


PROPERTIES

Count Property
Returns an integer that tells us how many Folder objects there are in the collection.

Syntax: object.Count

Item Property
Returns an Item based on a specified key (foldername).

Syntax: object.Item(foldername)