Click to See Complete Forum and Search --> : Counting line with ASP/FSO


weee
02-10-2007, 02:37 PM
Is there any I can count the lines in a html/asp/php/txt file while using FSO?

russell
02-10-2007, 03:52 PM
Dim fso
Dim tst
Dim lineCount
Dim str

lineCount = 0
Set fso = Server.CreateObject("Scripting.FileSystemObject")
Set tst = fso.OpenTextFile(filePathHere, 1, false)


While Not tst.AtEndOfStream
str = tst.ReadLine
lineCount = lineCount + 1
Wend

tst.close
Set tst = Nothing
Set fso = Nothing

Response.Write lineCount

weee
02-12-2007, 12:36 PM
thanks!