Skip to content

Latest commit

 

History

History
58 lines (46 loc) · 2.72 KB

README.md

File metadata and controls

58 lines (46 loc) · 2.72 KB

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.