Dir$

File name = Dir$ ( Directory [ , File pattern ] )

Returns the name of the first file in Directory that matches the pattern. If no pattern is specified, any file name is returned. The pattern can contain the same generic characters than the LIKE operator.

File name = Dir$ ( )

Returns the next entry of the directory given with the first syntax of Dir$().

Warning ! This function is not reentrant. You cannot use it recursively. In other words, you must finish browsing one directory before searching another.

Example :

' Print a directory

SUB PrintDirectory(Directory AS String)

  DIM File AS String

  File = Dir$(Directory, "*.*")

  WHILE File

    PRINT File
  
    File = Dir$()
  WEND

END


Referenced by :