Given a file tree – a directory with directories in it etc, how would you write a script to create a diagram of the file-tree as a graphic file that I can embed in a word processor document.
I prefer vector (SVG, EPS, EMF…) files.
The tool must run on Windows, but preferably cross-platform.
The tool may be commercial but preferably free.
Update 2012-02-20.
The question was related to a documentation sub project. I had to explan where files (in particular resources and configuration files) reside.
I ended up with using dos tree command. I both screen grabbed the result (for short folders) AND for longer folders I redirected to a text file, which I then edited. For example if a subfolder contained 20 similarly typed files that individually were not important to the point I was making, I left just two and replaced the rest with one … line. I then printed out the file to console again and screen grabbed it.
Before screen grabbing I had to modify foreground color to black and background color to white, to look better and save ink in a document should that be printed.
It is very surprising that there is no better tool for it. If I had time, I'd write a Visio Extension or may be some command line that produces SVG. SVG being HTML5 substandard, would even allow painless inclusion into online documentation.
Update 2017-10-17.
I am sorry that this question was removed as not belonging to SO. So I have re-worded it. I need a script – not a WYSIWYG tool. So any scripting language or library is ok. So it is a code – writing question, and I believe belongs to SO.
Best Solution
Copying and pasting from the MS-DOS
tree
command might also work for you. Examples:tree
tree /F
tree /A
tree /F /A
Syntax [source]
tree
[drive:
][path
] [/F
] [/A
]