-Log in
-Register (free)


-RSS Feeds
-New MyDesk Module
-Update to Profile

Alternate color for RS looping with For Next
Northwind / ASP - Nested select
ASP SQL Injection




 Forums /

Counting files in folder
russellcurti | Posted 2:09am 13. October 2002 Server Time |

It is possible to count the number of files in a subdirectory and return that figure as a variable?
bellasgirl | Posted 11:27am 14. October 2002 Server Time |

you can use the FileSystemObject to do that.  

------
dim fso, folder, subfolders, files

set fso = Server.CreateObject("Scripting.FileSystemObject")
Set Folder = fso.GetFolder(Server.MapPath("/"))
Set subFolders = Folder.SubFolders
Set files = subFolders.Files

ctr = 0
For each file in files
   set ctr = ctr + 1
next

----
I don't know of an easier way to do it, but I hope this helps.
1
Show all replies to 'Counting files in folder'
This post have been closed for new replies



| Info |
© Copyright 1997-2013 Alexander Haneng