Skip to content

A tool to write the directory tree to the console standard output stream, with colors support and a lot of customization options.

License

Notifications You must be signed in to change notification settings

maurizuki/ConsoleTree.FileSystem

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ConsoleTree.FileSystem

language issues version release downloads

A tool to write the directory tree to the console standard output stream, with colors support and a lot of customization options.

Getting started

To add ConsoleTree.FileSystem to your project, you can use the following NuGet Package Manager command:

Install-Package ConsoleTree.FileSystem

More options are available on the ConsoleTree.FileSystem page of the NuGet Gallery website.

Usage

Instantiate a FileSystemNode specifying the root directory and, optionally, if files must be included and a sort order. To write the directory tree to the console standard output stream, call the ConsoleTree.Tree.Write method specifying the FileSystemNode instance as parameter.

using ConsoleTree;
using ConsoleTree.FileSystem;

Tree.Write(new FileSystemNode(docsDirectory, new SearchSettings
{
    IncludeFiles = true,
    Comparer = new DirectoriesFirstComparer()
}), new DisplaySettings {IndentSize = 2});

// Output:
//
// docs\
// ├──ConsoleTree.FileSystem\
// │  ├──DirectoriesFirstComparer\
// │  │  ├──Compare.md
// │  │  └──DirectoriesFirstComparer.md
// │  ├──FileSystemNode\
// │  │  ├──FileSystemInfo.md
// │  │  ├──FileSystemNode.md
// │  │  ├──GetNodes.md
// │  │  └──ToString.md
// │  ├──SearchSettings\
// │  │  ├──Comparer.md
// │  │  ├──IncludeFiles.md
// │  │  └──SearchSettings.md
// │  ├──DirectoriesFirstComparer.md
// │  ├──FileSystemNode.md
// │  └──SearchSettings.md
// └──ConsoleTree.FileSystem.md

Resources

See the API reference and the ConsoleTree.FileSystem.Demo application for further informations. See also the ConsoleTree API reference to learn how to customize indentation, maximum depth, type of connectors and colors.