3

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:

audio
  mp3
    song1.mp3
    some other song.mp3
  audio books
    7 habits.mp3
video
  samples
    up.mov
    cars.mov

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

Pat
  • 949
nonopolarity
  • 9,886

3 Answers3

12

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

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

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

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.

James T
  • 10,351
  • 4
  • 30
  • 31
2

For Windows there is tree /f

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

2

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.