Read the Last Few Lines of a File


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)

Hide comments


  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.