

Your comments in the code enabled me to make the change easily even though I don't know sed. "Thank you much!! I changed double-dash to dash-space because I like that better. "This is great! I was already using a cut-down version to list directories, but I was frustrated that it didn't look very tidy! This is exactly what I needed and am now using at every client site that I visit! :)" "You might want to note that the above script requires the "GNU" versions of grep/sed." Will anybody take the challenge and come up with a working solution ?" I've tried for several hours but I haven't been able to come up with a solution. "I've challenged myself to come up with a solution based on this script that would not only output directories, but also the files in these directories. "Wonderful script, especially the more informative comments, source and document in a single file.good" Got a question or comment? Send a Message Message: Name: Email:Īll the fields are optional. Note: On many systems there is a folder search utility calledįind which returns a tree-like list.

Or just run the installer from the Terminal with the command: Test $topFolders -ne 0 || echo " -> no subfolders" TopFolders=$(ls -F -1 | grep "/" | wc -l) # 3rd sed: indent graph and add leading vertical bar # 2nd sed: replace higher level folder names with dashes # grep: select folders (filter out files) Test -z "$1" || cd "$1" #if parameter exists, use as base folder # in a single command to show the nesting of # # This tiny script uses "ls", "grep", and "sed" # # Displays structure of folder hierarchy # Here's the command ready-to-go in a shell script: tree.sh You can use the command to create a program called tree that would work

The current subfolders.", you'd be correct. If you said, " Well, that's obvious it shows a graphical representation of Quick, what does the following Unix/Linux command do?
