

Local dirListing = ListDirectory(dirToList) file)ĭirListing = ListDirectory(dirToList. Local fileAttr = lfs.attributes(dirToList. Local dirToList = arg or "C:/PrgCmdLine/tcc"ĭirToList = string.gsub(dirToList, "()$", "%1/")

~ local dirToList = arg or "C:/PrgCmdLine/Tecgraf" ~ local dirToList = arg or "C:/PrgCmdLine/Graphviz" Or it shouldn't be too hard to generate the SVG directly, I used Lua to generate SVG in the past. Not really a problem if you compress it after, to have a. Well, at least, it guarantees accurate rending even on systems without the font. Problem with the latter: Cairo generates it at low level, drawing the letters instead of using SVG's text capability. You can easily switch between PNG rendering and SVG one. Then, knowing the number of files, creating the canvas to fit (at least vertically) and drawing the names. So I made this version, first walking the directory tree, storing it in a Lua table. Inconvenience: I have to specify the image size beforehand, so listings are likely to be cut off. I made a first version drawing file names as I walked the tree.
#HOW TO CREATE A FILE FOLDER TREE PRO#
Lfs and LuaCairo are both cross-platform, so it should work on other systems (tested on French WinXP Pro SP3). I love these little challenges, as they allow me to explore APIs I wanted to dig for quite some time. I scripted it with Lua, using lfs to walk the directories.
#HOW TO CREATE A FILE FOLDER TREE CODE#
So it is a code - writing question, and I believe belongs to SO.Īs promised, here is my Cairo version. So any scripting language or library is ok. I am sorry that this question was removed as not belonging to SO. SVG being HTML5 substandard, would even allow painless inclusion into online documentation.

If I had time, I'd write a Visio Extension or may be some command line that produces SVG. It is very surprising that there is no better tool for it. I then printed out the file to console again and screen grabbed it.īefore 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. 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. I both screen grabbed the result (for short folders) AND for longer folders I redirected to a text file, which I then edited. I had to explan where files (in particular resources and configuration files) reside. The question was related to a documentation sub project. The tool may be commercial but preferably free. The tool must run on Windows, but preferably cross-platform. 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.
