|
Calling Sequence
|
|
ListDirectory(dir, opts )
|
|
Parameters
|
|
dir
|
-
|
path to the directory to be displayed
|
opts
|
-
|
(optional) argument of the form option or option=value where option is one of absolute, all, base, long, recurse, remove, returnonly, or select
|
|
|
|
|
Options
|
|
•
|
ListDirectory accepts these optional arguments: absolute, all, base, depth, long, recurse, remove, returnonly, and select.
|
|
Specifying absolute=true causes ListDirectory to return absolute paths for all listed files (see AbsolutePath). With the default value absolute=false, only the filenames themselves are returned.
|
|
By default, ListDirectory does not include filenames that begin with "." in its list of results. Specifying the all option causes ListDirectory to include these files.
|
•
|
base=one of bindir, datadir, homedir, mapledir, tempdir, toolboxdir, worksheetdir.
|
|
The base option specifies a base directory. If specified, the parameter dir is interpreted as a relative path under this directory. For the meaning of worksheetdir see interface; for any other of these symbols, see kernelopts.
|
•
|
depth=posint or infinity
|
|
Specifying depth with a value other than 1 causes ListDirectory to recursively traverse the complete directory tree starting with dir to the depth specified by depth.
|
|
Note that if depth is set to a value other than 1, the value of option absolute is implicitly set to true, and the special directories "." and ".." will not appear in the list of results even if all=true was specified.
|
|
Specifying depth=infinity is equivalent to specifying recurse=true.
|
|
Specifying long causes ListDirectory to returns a DataFrame structure which contains the name together with additional properties about each file, including size, whether or not the file is a directory, access permissions, and last modification date. The default is false.
|
|
Specifying recurse=true causes ListDirectory to recursively traverse the complete directory tree starting with dir. The default is false.
|
|
Note that if recurse=true, the value of option absolute is set to true, and the special directories "." and ".." will not appear in the list of results even if all=true was specified.
|
|
Specifying recurse=true is equivalent to specifying depth=infinity.
|
|
The remove option is used to remove elements from the list of filenames. Only the filenames that do not match the pattern specified in the string are returned. The pattern must conform to the form defined by StringTools[WildcardMatch].
|
|
The returnonly option is an alias for the select option.
|
|
The select option is used to select elements from the list of filenames. Only the filenames that match the pattern specified in the string are returned. The pattern must conform to the form defined by StringTools[WildcardMatch].
|
|
|
Description
|
|
•
|
The ListDirectory(dir) calling sequence returns the contents of the directory dir as a list.
|
•
|
If dir does not exist, ListDirectory generates an error.
|
•
|
If dir is not a directory, ListDirectory generates an error.
|
•
|
For information on filenames, see file.
|
|
|
Examples
|
|
>
|
|
| (1) |
>
|
|
| (2) |
>
|
|
| (3) |
>
|
|
>
|
|
| (5) |
>
|
|
| (6) |
>
|
|
>
|
|
|
|
Compatibility
|
|
•
|
The depth, long and recurse options were introduced in Maple 2018.
|
•
|
The base option was introduced in Maple 2020.
|
•
|
The FileTools[ListDirectory] command was updated in Maple 2024.
|
•
|
The remove and select options were introduced in Maple 2024.
|
|
|
|