full directory and subdirectory listings on windows using ‘tree’

I used to have to write my own command to insert into the register a way to have a context menu that said “Command Prompt Here” so I could right click on a folder and have a command prompt open up with that directory as the root.  It was much better than opening cmd and then typing cd c:/…. whatever directory.  Windows 7 has that available as a shift+right click option — in case you didn’t know.

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.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.