Page 1 of 1

ExamineDirectory question

Posted: Wed Jul 06, 2005 3:34 am
by Kanati2
I want to do a directory listing of multiple patterns at once... possible?

In vb you would normally ask in a file requester for "*.mpg|*.avi|*.mov" if I remember correctly. Is this possible in pb or do I need to roll my own handler for that?

Posted: Wed Jul 06, 2005 4:30 am
by Dare2
I don't think you can with pure PB. I have never managed this (but that is no reason to believe it cannot be done!).

Anyhow I use variations on the following:

Code: Select all

If ExamineDirectory(0, "Q:\DOWNLOADS", "")
  Repeat
    FileType = NextDirectoryEntry()
    If FileType
      FileName$ = DirectoryEntryName()
      If FileType = 2 ; Directory type
        Debug "<DIR> "+FileName$
      ElseIf FileType = 1
        w.s=LCase(FileName$)
        If Right(w,4)=".exe"
          Debug FileName$
        ElseIf Right(w,4)=".zip"
          Debug FileName$
        ElseIf Right(w,11)=".pb.declare"
          Debug FileName$
        EndIf
      EndIf
    EndIf
  Until FileType = 0 
Else
  Debug "DARN!"
EndIf
If that helps. Perhaps (hopefully) someone has a better way?