Part of the Samples Website. 8/16/97.

samples.basicStuff.countFolderLines

«Counts the lines of text in a folder full of text files
«it displays a running count of lines encountered so far
«uses Frontier's file.countLines built-in
local (folder)
if file.getFolderDialog ("Select a folder to count lines in.", @folder)
local (fname)
local (count = 0)
fileloop (fname in folder, infinity) «visit all files in the folder
rollBeachBall () «give the user something to watch
if file.type (fname) == 'TEXT' «only count in text files
window.msg (file.fileFromPath (fname))
count = count + file.countLines (fname)
msg (count + " lines so far.")
msg ("") «erase the main window
dialog.alert ("There are " + string.addCommas (count) + " lines in the folder.")


This page was last built on Sat, Aug 16, 1997 at 6:34:07 PM. You can download the current set of sample scripts from our FTP site. Dave