Click to See Complete Forum and Search --> : Files Counteer with FSO


weee
12-12-2004, 12:05 AM
Hi There.

Can I rus an FSO script that will count the number of files I have in a certain folder and then take the number and put it a VBscript dim?

Thanks!

russell
12-12-2004, 12:42 AM
Dim fso
Dim fld
Dim numFiles

Set fso = Server.CreateObject("Scripting.FileSystemObject")
Set fld = fso.GetFolder("c:\myFolder")

numFiles = fld.Files.Count

set fld = Nothing
set fso = Nothing

Response.Write "There are " & numFiles & " in myFolder"

weee
12-12-2004, 12:49 AM
I just got this one:

[/code]
Set fso = CreateObject("Scripting.FileSystemObject")
Set folder = fso.GetFolder(Server.mapPath("/photos"))
Set files = folder.Files

dim c :c=1
For Each file in Files
%>
<img src="<%=c%>.jpg">
<%
c=c+1
Next

Set files = Nothing
Set file = Nothing
Set fso = Nothing
[/code]

I think that you're make more sense, isn't it?

russell
12-12-2004, 02:20 AM
i like mine, but both work. :)

weee
12-12-2004, 05:02 AM
Thanks man!