Change the current working directory to dir.
If called with no input or output arguments, the current directory is
changed to the user’s home directory (
changes the current working directory to ~/octave. If the directory does not exist, an error message is printed and the working directory is not changed.
chdir is an alias for
cd and can be used in all of the same
Compatibility Note: When called with no arguments, MATLAB prints the present working directory rather than changing to the user’s home directory.
List directory contents.
ls function forwards to the
ls command if it is available.
It falls back to calling the native operating system’s directory listing
command. Available options may vary from system to system.
Filenames are subject to shell expansion if they contain any wildcard characters ‘*’, ‘?’, ‘’. If these wildcard characters are escaped with a backslash ‘\’ (e.g., ‘\*’) then they are not treated as wildcards, but instead as the corresponding literal character.
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
Query or set the shell command used by Octave’s
See also: ls.
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
File or directory name.
Location of file or directory
Timestamp of file modification (string value).
File size in bytes.
True if name is a directory.
Timestamp of file modification as serial date number (double).
Information structure returned from
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 ‘*’, ‘?’, ‘’. If these wildcard characters are
escaped with a backslash ‘\’ (e.g., ‘\*’) on a POSIX platform,
then they are not treated as wildcards, but as the corresponding literal
character. On Windows, it is not possible to escape wildcard characters
because backslash ‘\’ is treated as a file separator. On Windows, use
ls for file or folder names that contain characters that would be
treated as wildcards by
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.