SUB PrintDir(path:STRING),INT
DEF count:INT
DEF dir,attrib=0:INT
DEF filename:STRING
DEF fullname:STRING
count = 0
dir = FINDOPEN(path + "*.*")

string Caption = getcaption w1
Caption = mid$(Caption,1,instr(Caption,".")-1)
IF(dir)
   DO
      filename = FINDNEXT(dir,attrib)
      IF len(filename)
         IF attrib & @FILE_DIRECTORY
            IF(filename <> ".") & (filename <> "..")
               fullname = path + filename + "\\"
               count = count + printdir(fullname)
            ENDIF
         ELSE
            if instr(filename,".ini") and instr(filename,Caption) = 0
               count = count + 1
               ADDSTRING w1,Combo1,filename
            endif
         ENDIF
      ENDIF
   UNTIL filename = ""
   FINDCLOSE dir
ENDIF
RETURN count
ENDSUB
