DIR List Files Function

Section: Operating System Functions

Usage

In some versions of FreeMat (pre 3.1), the dir function was aliased to the ls function. Starting with version 3.1, the dir function has been rewritten to provide compatibility with MATLAB. The general syntax for its use is
  dir

in which case, a listing of the files in the current directory are output to the console. Alternately, you can specify a target via

  dir('name')

or using the string syntax

  dir name

If you want to capture the output of the dir command, you can assign the output to an array

  result = dir('name')

(or you can omit 'name' to get a directory listing of the current directory. The resulting array result is a structure array containing the fields:

Note that 'name' can also contain wildcards (e.g., dir *.m to get a listing of all FreeMat scripts in the current directory.