DIR List Files Function
Section: Operating System Functions
Usage
In some versions of FreeMat (pre 3.1), thedir 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:
-
namethe filename as a string -
datethe modification date and time stamp as a string -
bytesthe size of the file in bytes as auint64 -
isdira logical that is1if the file corresponds to a directory.
'name' can also contain wildcards (e.g., dir *.m to get a listing of
all FreeMat scripts in the current directory.
