File Handling
DIRECTORY File Processing  
  Prior Next
 

Directory files represent the operating system directory tables which maintain the list of files present in the system. ProvideX provides read access to these directory lists. When a directory is opened the records read from it contain the names of the files within the directory. The names are not returned in any specific order. The sequence of the entries within a directory is an operating system function.

When opening a directory the INPUT option should be specified on the OPEN directive. ProvideX will not allow the user to write to a directory file.

Normally when reading a directory ProvideX/PxPlus will return each of the file and sub-directory names in the directory.   If the system 'SD' parameter is enabled, sub-directories names will be returned with a trailing a directory delimiter (slash).

Example:

Display directory listing

0010 OPEN INPUT (1) LWD ! Open current directory
0020 READ (1,END=1000) FL_NAME$ ! Get file name
0030 PRINT FL_NAME$ ! Display file name
0040 GOTO 0020
1000 CLOSE (1)
1010 END

Special Directory processing

If using PxPlus and the programmer specifies OPT="+INFO" on the OPEN of a directory, the system will return six (6) fields.

  • File name
  • File type ("F" for file, "D" for directory)
  • File size in bytes
  • Date created
  • Date last modified
  • Date last accessed

All dates will be returned in form YYYY-MM-DD hh:mm:ss.

  Prior Next