bell notificationshomepageloginNewPostedit profile

Topic : Re: Writing a programming book: how to present directory structures What is good/preferred way of presenting directory trees in programming books? My main criteria are following: It should be readable - selfpublishingguru.com

10% popularity

I would go with option 2. However, you do not need to manually build the structure. I instead recommend using a tool such as Tree which should handle the pretty-printing for you as below:

$ tree -d /var
var
|-- backups
|-- cache
| |-- app-install
| |-- apt
| | `-- archives
| | `-- partial
| |-- apt-xapian-index
| | |-- index.1
| | `-- index.2
| |-- cups
| | `-- rss
| |-- debconf
| |-- dictionaries-common
| |-- flashplugin-installer
| |-- fontconfig
| |-- hald
| |-- jockey
| |-- ldconfig [error opening dir]
| |-- man

The script should be available as a package in your distro. I can confirm that it is in Ubuntu.

I also suggest that you contact your editor to get his/her opinion. The publisher very likely has its own style guidelines for such matters (with layout in mind). If you do go ahead with a text representation, I recommend that you add a sticky somewhere reminding you to check the indentation in the final - whitespace often gets messed up when the book is laid out.

P.S. ... and your editor will prefer a textual representation as well - saves ink ;)


Load Full (0)

Login to follow topic

More posts by @Welton431

0 Comments

Sorted by latest first Latest Oldest Best

Back to top