VBScript » Objects » TextStream
VBScript » Objects » Files Collection
Version: 3.0
The Files collection contains a set of File objects and is usually stored as a property of another object, such as a Folder object.
Examples
Code:
<%
Dim filesys, demofolder, fil, filecoll, filist
Set filesys = CreateObject("Scripting.FileSystemObject")
Set demofolder = filesys.GetFolder("foldername")
Set filecoll = demofolder.Files
For Each fil in filecoll
filist = filist fil.name
filist = filist "<BR>"
Next
Response.Write filist
%>
Explanation:
This code demonstrates how to get a Files collection and list the contents in the browser.
Properties
- Count
- Syntax: object.CountReturns an integer that tells us how many File objects there are in the collection.
- Item
- Syntax: object.Item ("filename") [= itemvalue]The Item property allows us to retreive the value of an item in the collection designated by the specified key argument and also to set that value by using itemvalue.
0 comments:
Post a Comment
Note: only a member of this blog may post a comment.