I'm trying to build a browser application that visualizes file structures, so I want to print the file structure into a JSON object.
I've tried using many variation of 'ls' piped to sed, but it seems like find works best.
Right now I'm just trying to use the command
find ~ -maxdepth ? -name ? -type d -print
And tokenize the path variables
I've tried just simple ajax with PHP-exec this, but the array-walking is really slow. I was thinking to do it straight from bash script, but I can't figure out how to get the pass-by-reference for associative arrays to recursively add all the tokenized path variables to the tree.
Is there a better or established way to do this?
Thanks!