1. SirGru
  2. PathToTree




Program transforms a series of file paths piped in, one file path per line, into a tree structure, similar to what would Windows' tree command create.

Intent and purpose:

The intent of the software was to make a small command line utility that would transform the output of hg status command from a list of filenames into a tree view. It would properly support file status attributes reported from Mercurial. Also, it is intended to give option for colorized output, which is displayed with an external utility(cmdcolor, https://github.com/jeremejevs/cmdcolor).

There are possibly other uses for such a tool, so it is configurable to some degree.


Program does not sanitize the paths, provide paths in Windows-style (backslash '\' instead of slash '/'), and remove any double path slashes. Program assumes the last item in the path is a file, not a folder. This is visible in test data example. Options can be specified either Windows or Unix style.

  • Use options -t for Test data.
  • Use option -s to properly display Status flags from hg status commands.
  • Use option -c to allow Color output, which you must pipe to cmdcolor.exe, as here: https://github.com/jeremejevs/cmdcolor
  • Use option -i to print tree with Invisible branches, useful if you like the 'light' view or don't support unicode.
  • Use option -l to print Large tree, a tree with spaces between folders.

How do I use it?

  • Place the .exe some where on your %PATH%.
  • Pipe in input lines, one line per file.
  • Use any switches, described in Details section.


> hg status
? asd\gfgfdg\asdasd\asdasd\ghfg.txt
? asd\gfgfdg\asdasd\erert.txt
? asd\gfgfdg\ggdfg.txt
? asd\gfgfdg\ghfh.txt


> hg status | PathToTree /c /s | cmdcolor            
 └─┬ gfgfdg                                          
   │  ? ggdfg.txt                                    
   │  ? ghfh.txt                                     
   └─┬ asdasd                                        
     │  ? erert.txt                                  
     └── asdasd                                      
          ? ghfg.txt