ExamineDirectory question

Just starting out? Need help? Post your questions and find answers here.
Kanati2
User
User
Posts: 27
Joined: Thu Jun 03, 2004 5:18 am
Contact:

ExamineDirectory question

Post 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?
Dare2
Moderator
Moderator
Posts: 3321
Joined: Sat Dec 27, 2003 3:55 am
Location: Great Southern Land

Post 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?
@}--`--,-- A rose by any other name ..
Post Reply