Procedure.s WalkRecursive(dir,path.s,Pattern.s="\.txt$") Static RegularExpression If Not RegularExpression RegularExpression=CreateRegularExpression(#PB_Any,Pattern) EndIf While NextDirectoryEntry(dir) If DirectoryEntryType(dir)=#PB_DirectoryEntry_Directory If DirectoryEntryName(dir)<>"." And DirectoryEntryName(dir)<>".." If ExamineDirectory(dir+1,path+DirectoryEntryName(dir),"") WalkRecursive(dir+1,path+DirectoryEntryName(dir)+"\",Pattern) FinishDirectory(dir+1) Else Debug "Error in "+path+DirectoryEntryName(dir) EndIf EndIf Else ; e.g. #PB_DirectoryEntry_File If MatchRegularExpression(RegularExpression,DirectoryEntryName(dir)) Debug DirectoryEntryName(dir) EndIf EndIf Wend EndProcedure