On windows, there’s a
tree command to display the directory structure of a path or of the disk in a drive graphically. For convenience, I wrote a right-click menu. Whenever I need to get the directory information of a folder, I just need to right-click on the folder and select
Get Tree Here to generate a
.ctre file in the current directory. The
.ctre file contains the output of the
This code snippet is also available in my gist.
First, I created a batch file named
REM file: gettree.bat @tree "%~1" /F /A | more /E /S +2 > "%~1\%~nx1.ctre"
Then, I added this batch file to the right-click menu through registry.
Windows Registry Editor Version 5.00 [HKEY_CLASSES_ROOT\Directory\Background\shell\getTree] @="Get Tree Here" "MultiSelectModel"="Player" [HKEY_CLASSES_ROOT\Directory\Background\shell\getTree\Command] @="X:\\Command\\gettree \"%V\"" [HKEY_CLASSES_ROOT\Directory\shell\getTree] @="Get Tree Here" "MultiSelectModel"="Player" [HKEY_CLASSES_ROOT\Directory\shell\getTree\Command] @="X:\\Command\\gettree \"%1\""
X:\\Command\\gettree to the path of
gettree.bat. Save the above code as
gettree_reg.reg, double-click this file, and the menu item of
Get Tree Here will be added to the right-click menu.
After the above steps, right-click the folder or drive and a
Get Tree Here option will appear.
The following is the execution result in a test directory.
R:\INPUT | input.ctre | +---AsciiMath | config.js | jax.js | +---MathML | | config.js | | jax.js | | | \---entities | a.js | b.js | c.js | d.js | e.js | f.js | fr.js | g.js | h.js | i.js | j.js | k.js | l.js | m.js | n.js | o.js | opf.js | p.js | q.js | r.js | s.js | scr.js | t.js | u.js | v.js | w.js | x.js | y.js | z.js | \---TeX config.js jax.js