dir

Prev Next

Function Names

dir

Library

Support Library

Description

This function is a simplified version of file browser() which provides the directory listing where you can navigate. The cursor supported navigation keys, function keys and commands are described below. If called as a function, and the Enter key is used to return, the it contains the full path name of the selected file. The differences of dir() and file browser() are the following:

  • In interactive mode, use it as a short and familiarized command. Just type dir
  • Some settings are already made, e.g. files of known types appear in their characteristic caolors, e.g. green for (Microsoft Excel) spreadsheets.

Call as: procedure or function

Restrictions

Under normal conditions, the 'Support Library' is loaded automatically, so no 'include(...)' call is needed.
Not suitable for batch processing

Parameter count

0-2

Parameters

No.TypeDescription
Opt. 1
input
string Path

Specify an existing path. Relative paths such as specifying subdirectories, '..' for parent folder, '.' for current folder, etc. are supported. Wildcards are not allowed here.

Default value: . (current folder)
Opt. 2
input
string Pattern

Specify the pattern to be applied for the file names. Folder names are not affected by this. For exapmle, specify "*.xlsx,*.xlsm" to include all Excel files with and without macros.

Note: Regarless if running under Windows or LINUX, pattern checks with file names are always case-insensitive.

Default value: * (all files)

Return value

TypeDescription
string Chosen file

If the directory listed is ended by pushing [Enter] on the selected file, then the path provided and file name will be returned.
If [Escape] has been pressed instead, then an empty string will be returned.

Examples

       dir;
       dir ('.\Tables', '*.xlsx' );

See also

file browser
directory listing