I am working with a piece of code that will scroll through directories on a drive searching for a specific file type. ie .txt

The DIR function can filter out files that I am interested in.

myItem = Dir(myDirectory & "*.TXT")
My question is, can the same be done with the FileSystemObject?

I am using the following code, but it is looping through about a billion files that I am not interested in.

    Dim objFolder As Scripting.Folder
    Dim objFile As Scripting.File

    For Each objFile In objFolder.Files
        If UCase(Right(objFile.ShortPath, 4)) = ".TXT" Then
              '.TXT File Found!!!
    Next objFile
Any help would be much appreciated.

[This message has been edited by Kevin Burt (edited 11-03-1999).]