Return to Snippet

Revision: 23538
at February 9, 2010 03:59 by ginoplusio


Initial Code
Function countFiles(path,ext)
	Dim fs, folder, c
	c = 0
	Set fs = CreateObject("Scripting.FileSystemObject")
	Set folder = fs.GetFolder(path)
	For Each item In folder.Files
		If UCase(Right(item.Name, Len (ext))) = UCase(ext)) Then c=c+1
	Next
	countFiles = c
End Function

Initial URL
http://www.barattalo.it/2010/02/09/asp-function-to-count-files-in-a-folder/

Initial Description
This ASP function counts files of a specified extension inside a folder: this is done by creating a file system object, open folder and scan files for matching the extension. The match of the extension is made without regular expression but using string functions: Right, Len and Ucase.

Initial Title
ASP Function to count files in a folder

Initial Tags


Initial Language
ASP