This is Cat's Eye Technologies'
tree, a command-line tool that displays an
indented directory tree, similar to "The Tree Command for Linux" except simpler.
- is written in Python (tested with 2.7.12 and 3.5.2)
- is small and has no dependencies besides Python
- is in the public domain (see
- is really quite crude
- displays a summary of the directory structure by default (because to me, that's the point of this sort of tool: give me a conceptual overview of the directory structure at this point in the filesystem, so I can orient myself)
- never follows symbolic links
- always outputs a
/after each directory name
- doesn't have any ASCII art (yet; it might someday as the lines do make it a bit easier to "read" the tree)
- has no build/install system; either copy it to somewhere on your
search path, or alter your search path to include the
scriptdirectory in this repo, or use some system that solves this problem, like shelf.
tree [-f|--full] [-1|--1-line] [-c|--count] [-w|--max-width <int>] [-x|--exclude <list>] [DIRECTORY]
If DIRECTORY is not supplied, the current directory is assumed.
--full option lists each file in a directory on its own line.
--1-line option lists a summary of the files in each directory
on one line, truncating the line if it is longer than the max-width.
--count option causes a count of files in each directory to
be display instead of listing the files themselves.
If none of those options are given, all files in a directory are listed compactly over multiple lines, in a "block".
--max-width option can be used to set the length of truncation
or block-wrapping. It defaults to the width of the terminal window
as returned by
stty size, if that program can be run, otherwise 75.
--exclude option sets the list of directory names to not descend
into (a comma-separated list). It defaults to
git clone https://git.catseye.tc/tree/
- Final edits to README before release of 1.1. Chris Pressey 1 year, 7 months ago
- Delete .hgtags, add .gitignore Chris Pressey 1 year, 7 months ago
- Edit README to make it all up-to-date. Chris Pressey 1 year, 7 months ago
- Add --count option. Chris Pressey 2 years ago
- Add --exclude option and update documentation. Chris Pressey 3 years ago
- Put some parens on the print statements, so it works in Python 3. Chris Pressey 3 years ago
- "Block" view of files in a dir. Default. -1 = 1-line, -f = list Chris Pressey 5 years ago
- Rewrite print_tree() to be less hacky. Chris Pressey 5 years ago
- Merge branch 'master' of https://github.com/cpressey/tree Chris Pressey 5 years ago
- Default to detected console width. Width contains ellipsis, now. Chris Pressey 5 years ago