Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

With each use of DirList(), a list of filenames will be returned from the specified directory. DirList() may be placed in a loop to obtain all the filenames in a large directory. The loop would continue until the list is empty. Filenames are separated by field marks (ASCII character 254).

See also

Drive()SetInitDirOptionsInitDir

Example

Code Block
/* Looks at each file in the C:\WINDOWS directory. 
Variable AB_COUNT keeps a count of the number of files with names starting with "A" or "B". */
InitDir "C:\WINDOWS\*.*"
AB_COUNT = 0
 
files = DirList()
 
position = 1
flag  = ""
Loop
   Remove this_file From files At position Setting flag
   first_letter = this_file[1,1]
   if first_letter _eqc "a" or first_letter _eqc "b" then
      AB_COUNT += 1
   end
While flag
Repeat
 
call msg(@window,"There are " : AB_COUNT : " files in the directory starting with an A or B.")