generate iterator to traverse subdirectories under a given directory
Walk(dir, traversal, opts)
path to the base of the directory structure to be traversed
(optional) one of the symbols topdown or bottomup
(optional) argument of the form option or option=value where option is one of followlinks.
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.
Indicates whether the traversal will follow symbolic links and traverse the subdirectories underneath the link destination. When false, a symbolic link which points to a directory will appear in the files field of the record corresponding to its parent directory and not the subdirs field. The default value is false.
The Walk(dir, traversal, opts) command returns an iterator object which can be used to traverse the subdirectories under the file path dir.
The path dir must correspond to an existing directory. It can be relative or absolute; if relative, it is interpreted as relative to the current directory as reported by currentdir.
With each step, the iterator object will return a record with three fields: dir, subdirs, and files.
dir is the path of a directory within the hierarchy rooted at dir,
subdirs is the list of subdirectories within dir,
files is the list of files within dir.
The optional parameter traversal specifies the type of traversal. Permissible values are topdown which means that the record for a directory will be returned before any of its subdirectories, or bottomup which means that the record for a directory will be generated after all of its subdirectories.
The iterator object is an Iterator with hasNext and getNext methods as defined by the Iterator API.
The state of an iterator object iter may be reset to the beginning of the iteration by invoking Reset(iter).
FileTools:-Walk IteratorBase directory: /home/someuserTraversal: top-down
The FileTools[Walk] command was introduced in Maple 2020.
For more information on Maple 2020 changes, see Updates in Maple 2020.
Download Help Document
What kind of issue would you like to report? (Optional)