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


objects constants operators statements functions properties methods







OBJECT:  Files Collection


The Files collection contains a set of File objects and is usually stored as a property of another object, such as a Folder object.

The following code demonstrates how to get a Files collection and list the contents in the browser.

Code:
<%
Dim filesys, demofolder, fil, filecoll, filist
Set filesys = CreateObject("Scripting.FileSystemObject")
Set demofolder = filesys.GetFolder("foldername") 
Set filcoll = demofolder.FIles

For Each fil in filecoll
    filist = filist & fil.name 
    filist = filist & "<BR>" 
Next  
Response.Write filist
%>

PROPERTIES

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

Syntax: object.Count

Item Property
Retrieves an Item from a collection based on a specified key (filename).

Syntax: object.Item("filename")


METHODS

The Files collection has no Methods.