This question evaluates filesystem traversal and recursive/iterative algorithm skills, including handling different path types, edge cases such as missing or inaccessible paths, and robustness concerns like symlink cycles when enumerating files.
You are building a simple file crawler.
Implement an API/function:
rootPath
rootPath
(recursively), in any order.
Assume:
listChildren(path) -> (subdirs, files)
where
subdirs
are immediate child directories and
files
are immediate child files.
rootPath
is a file, return just
[rootPath]
.