Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I wonder if there is a tool that will list file / directory (i.e. take a snapshot of the folder and file structure) like the following:

    some other song.mp3
  audio books
    7 habits.mp3

in other words, in a tree structure.

The Unix command ls -R or ls -lR can do something similar, except it won't list it indented in a tree structure

share|improve this question
up vote 12 down vote accepted

In both Windows and Linux there is a command called tree.

In windows, the tree command (or tree /A /F) creates something like this:

│   ├───dbcopy
│   │   └───util
│   ├───mssql
│   │   └───gui
│   ├───oracle
│   │   └───gui
│   ├───refactoring
│   │   └───gui
│   └───sqlscript
│       └───prefs

In Ubuntu 10.04 you have to install tree with sudo apt-get install tree

In linux it looks like this (tree -a /)

|   |       |-- graphics
|   |       |   `-- fbcon
|   |       |       |-- cursor_blink
|   |       |       |-- power
|   |       |       |   `-- wakeup
|   |       |       |-- rotate
|   |       |       |-- rotate_all
|   |       |       |-- subsystem -> ../../../../class/graphics
|   |       |       `-- uevent

These are just small snippets of the tree.

For Mac, you could install the tree command following the instructions at this SuperUser.SE answer if you desire the same functionality.

share|improve this answer
If you want to save it to a file (at least in Windows), you can use the /A switch and redirect to a file (tree /A /F > tree.txt), but that only uses ASCII characters. Alternatively, you can use Unicode by redirecting to an RTF file, opening it in Word, and converting from "Encoded Text" with MS-DOS encoding. In that case, the command is tree /F > tree.rtf. – Pat Feb 21 '11 at 16:03

For Windows there is tree /f

By default, tree just displays directories. The /f option displays files within each directory as well.

share|improve this answer

Just for completeness: On Mac OS X, this program tree is available through fink: fink install tree. (Probably available through MacPorts as well.) Of course you can also just download the source and compile it yourself.

share|improve this answer
Yes - it is available in MacPorts too. – dtlussier Sep 20 '10 at 13:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .