Navigation

Operators and Keywords

Function List:

C++ API

: ls
: ls filenames
: ls options
: ls options filenames
: list = ls (…)

List directory contents.

The ls command is implemented by calling the native operating system’s directory listing command—available options will vary from system to system.

Filenames are subject to shell expansion if they contain any wildcard characters ‘*’, ‘?’, ‘[]’. To find a literal example of a wildcard character the wildcard must be escaped using the backslash operator ‘\’.

If the optional output list is requested then ls returns a character array with one row for each file/directory name.

Example usage on a UNIX-like system:

ls -l
     -| total 12
     -| -rw-r--r--   1 jwe  users  4488 Aug 19 04:02 foo.m
     -| -rw-r--r--   1 jwe  users  1315 Aug 17 23:14 bar.m

See also: dir, readdir, glob, what, stat, filesep, ls_command.

Package: octave