I named the Tail function, which Listing A shows, Tail(ByVal FilePath, ByVal LineCount), after a UNIX tool with a similar purpose: reading the last few lines of a file. Calling Tail from a script can be memory intensive for large files because your script must first read the entire file to find the lines it needs to read.

Call Tail("C:\windows\xpsp1hfm.log", 10)