FileSystemTree [root]
gives a tree whose keys are the names of files in root, and whose data is the full names of these files.
FileSystemTree [root,levelspec]
gives a tree in which files on levels specified by levelspec are represented by a subtree.
FileSystemTree [root,levelspec,r]
combines levels to give a tree with maximum level r.
FileSystemTree
FileSystemTree [root]
gives a tree whose keys are the names of files in root, and whose data is the full names of these files.
FileSystemTree [root,levelspec]
gives a tree in which files on levels specified by levelspec are represented by a subtree.
FileSystemTree [root,levelspec,r]
combines levels to give a tree with maximum level r.
Details and Options
- FileSystemTree uses standard level specifications as in TreeLevel :
-
n levels 1 through n{n} level n only{n1,n2} levels n1 through n2
- The default value for levelspec in FileSystemTree is {0,Infinity }.
- FileSystemTree takes the same options as Tree .
- Additional options of FileSystemTree include:
-
- FileNameForms will accept any forms specification allowed in the first argument of FileNames .
Examples
open all close allBasic Examples (3)
Create a tree of all files contained in a directory:
Create a tree of all files through level 2 of the specified directory:
Create a tree containing only those files at level 2 of the specified directory:
Create a flat tree for the same directory:
Options (12)
Elision (1)
Display two children of all nodes:
FileNameForms (1)
By default, all files are included:
By specifying FileNameForms->patt, the tree will be restricted to only those files that match the specified pattern:
IncludeDirectories (1)
Empty directories have no children by default:
Include All as a child of every directory:
MaxItems (1)
By default, the tree will contain all files in the specified directory and subdirectories:
By specifying MaxItems n, the tree will contain at most n items within each directory:
Styling Entire Tree (4)
Specify labels and styles for all subtrees:
Specify the base style:
Specify the style for the edges and the edges of the tree elements:
Specify the base style and styles for individual tree elements:
Styling Individual Tree Elements (1)
Specify the style for the generated tree element:
Tree Layout and Graphics Options (3)
Properties & Relations (1)
TreeExpression [FileSystemTree[root,…],"FileSystem"] is equivalent to FileSystemMap [Identity ,root,…]:
Possible Issues (1)
When specifying a fixed number of levels, empty directories will be omitted from the resulting tree:
Related Guides
History
Text
Wolfram Research (2022), FileSystemTree, Wolfram Language function, https://reference.wolfram.com/language/ref/FileSystemTree.html.
CMS
Wolfram Language. 2022. "FileSystemTree." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/FileSystemTree.html.
APA
Wolfram Language. (2022). FileSystemTree. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/FileSystemTree.html
BibTeX
@misc{reference.wolfram_2025_filesystemtree, author="Wolfram Research", title="{FileSystemTree}", year="2022", howpublished="\url{https://reference.wolfram.com/language/ref/FileSystemTree.html}", note=[Accessed: 17-November-2025]}
BibLaTeX
@online{reference.wolfram_2025_filesystemtree, organization={Wolfram Research}, title={FileSystemTree}, year={2022}, url={https://reference.wolfram.com/language/ref/FileSystemTree.html}, note=[Accessed: 17-November-2025]}