I used to use the ‘tree’ command in windows to print out directory listings. I used these for making a semi automated way of adding files to my webapps (get the tree of a structure then add those directory structures as image paths, or what have you). All of that was a long, long, long time ago.
In Oct 2005 I attended an NFJS event in Denver where I learned about Groovy and have been using it ever since. I love Groovy a lot. If I have the opportunity to use Groovy I’ll take it. For a long time, I was using the Groovy Recipes and other snippets to loop through directories and give me back that information. Great code. Sometimes, however, you just need a list of the items in a directory and don’t need to manipulate it in any way. That’s where ‘tree’ comes back in handy.
I only want to have a single text file with the directory structure of all of the directories, subdirectories, and files in it from my starting point.
Open a command prompt where ever you are wanting the structure
‘tree /F > out.txt’
That’s it. The /F follows the structure down to the bottom. In my case, I’m working on a book where I have a ton of reference materials. I want to make sure I reference each book correctly AND that I have looked at all of the material in each book. I’ll use this text file to mark off the chapters I looked at, the individual elements, and for the bibliography.