Navigation

Operators and Keywords

Function List:

C++ API

Function File: dir
Function File: dir (directory)
Function File: [list] = dir (directory)

Display file listing for directory directory.

If directory is not specified then list the present working directory.

If a return value is requested, return a structure array with the fields

name

File or directory name.

date

Timestamp of file modification (string value).

bytes

File size in bytes.

isdir

True if name is a directory.

datenum

Timestamp of file modification as serial date number (double).

statinfo

Information structure returned from stat.

If directory is a filename, rather than a directory, then return information about the named file. directory may also be a list rather than a single directory or file.

directory is subject to shell expansion if it contains any wildcard characters ‘*’, ‘?’, ‘[]’. To find a literal example of a wildcard character the wildcard must be escaped using the backslash operator ‘\’.

Note that for symbolic links, dir returns information about the file that the symbolic link points to rather than the link itself. However, if the link points to a nonexistent file, dir returns information about the link.

See also: ls, readdir, glob, what, stat, lstat.

Package: octave