I use this code to get a file count recursively on a folder is the a more efficient way of doing this??
<%
Dim cnt
Sub Recurse(Path)
Dim fso, Root, WindowsFolder, Files, Folders, File, i, FoldersArray(10000)
Set fso = Server.CreateObject(“Scripting.FileSystemObject”)
Set Root = fso.getfolder(Path)
Set Files = Root.Files
Set Folders = Root.SubFolders
Server.ScriptTimeout = 10000
For Each Folder In Folders
Dim objFSO, objFolder
Set objFSO=Server.CreateObject(“Scripting.FileSystemObject”)
Set objFolder=objFSO.GetFolder(Folder.Path)
cnt = cnt + objFolder.files.Count
Set objFolder = Nothing
Set objFSO = Nothing
FoldersArray(i) = Folder.Path
i = i + 1
Next
For i = 0 To UBound(FoldersArray)
if FoldersArray(i) <> “” Then
Recurse FoldersArray(i)
Else
Exit For
End if
Next
End Sub
Recurse “D:Folder to Count”
%>
Thanks
Dr5150ut