# DIR

Display listings of files

Syntax

  DIR [<cFileMask>]

Arguments

  <cFileMask> File mask to include in the function return. It could contain path and standard wildcard characters as supported by your OS (like * and ?). If <cFileMask> contains no path, then SET DEFAULT path is used to display files in the mask.

Description

  If no <cFileMask> is given, __Dir() display information about all *.dbf in the SET DEFAULT path, this information contain: file name, number of records, last update date and the size of each file.
  If <cFileMask> is given, __Dir() list all files that match the mask with the following details: Name, Extension, Size, Date.
  DIR command is preprocessed into __Dir() function during compile time.
  __Dir() is a compatibility function, it is superseded by DIRECTORY() which returns all the information in a multidimensional array.

Examples

          DIR          // information for all DBF files in current directory

          dir   "*.dbf"          // list all DBF file in current directory

          // list all PRG files in Harbour Run-Time library
          // for DOS compatible operating systems
            Dir  "c:\harbour\source\rtl\*.prg"

          // list all files in the public section on a Unix like machine
            Dir  "/pub"

Status

  Ready

Compliance

  DBF information: CA-Clipper displays 8.3 file names, Harbour displays the first 15 characters of a long file name if available.
  File listing: To format file names displayed we use something like: PadR( Name, 8 ) + " " + PadR( Ext, 3 ) CA-Clipper use 8.3 file name, with Harbour it would probably cut long file names to feet this template.

See Also

- ADIR()
- DIRECTORY()
- SET DEFAULT
- __DIR()*