Windows – How to export a directory structure in Windows

directory-listingwindows

In Windows Explorer, there is a tree-view to see the overview of a directory structure. I want to share the structure to other people.

How can I get a browsable tree-view of the directory structure of a partition and export that file-list, so that others can view it without access to the partition?

To clarify, I am not interested in the files themselves. I just need a hierarchical listing of all files. Zipping them all up is not what I want.

Best Answer

Assuming your directory tree is of reasonable size, you could also use the built in tree command, which produces a rather pretty looking directory tree. Unfortunately this prettiness is difficult to get working outside of a cmd instance, so you'll probably want to tell it to just use ascii characters with the /A switch.

Example:

From a small multi-level structure

+---A
|   +---A
|   \---B
+---B
|   \---A
|       \---A
\---C

You can then redirect this to a file using a command like:

tree /A ["directory path"] > tree.txt

Where the directory path is optional, but useful if you want to tree something which isn't the current working directory.