Merge branch 'master' of https://github.com/cpressey/tree
Chris Pressey
10 years ago
0 | 0 |
`tree`
|
1 | 1 |
======
|
2 | 2 |
|
3 | |
This is Cat's Eye Technologies' `tree`, a simple command-line tool that
|
4 | |
displays an indented directory tree. It:
|
|
3 |
This is `tree`, a command-line tool that displays an indented directory tree,
|
|
4 |
similar to "The Tree Command for Linux" except simpler. It:
|
5 | 5 |
|
6 | 6 |
* is written in Python (tested with 2.7.6)
|
7 | 7 |
* is small and has no dependencies besides Python
|
|
11 | 11 |
me, that's the point of this sort of tool: give me a conceptual overview of
|
12 | 12 |
the directory structure at this point in the filesystem, so I can orient
|
13 | 13 |
myself)
|
|
14 |
* never follows symbolic links
|
14 | 15 |
* supports one option, `--full`, which lists all files in each directory
|
15 | 16 |
instead of giving you the summary
|
16 | 17 |
* always outputs a `/` after each directory name
|
|
26 | 27 |
|
27 | 28 |
tree [-f|--full] [DIRECTORY]
|
28 | 29 |
|
|
30 |
If DIRECTORY is not supplied, the current directory is assumed.
|
|
31 |
|
29 | 32 |
Related work
|
30 | 33 |
------------
|
31 | 34 |
|
16 | 16 |
if filename.startswith('.'):
|
17 | 17 |
continue
|
18 | 18 |
fullname = os.path.join(dirname, filename)
|
19 | |
if os.path.isdir(fullname):
|
|
19 |
if os.path.islink(fullname):
|
|
20 |
subfilenames.append(filename)
|
|
21 |
elif os.path.isdir(fullname):
|
20 | 22 |
dirnames.append(filename)
|
21 | 23 |
else:
|
22 | 24 |
subfilenames.append(filename)
|