2

I've found this command to show a tree of the directories under the current one:

ls -R | grep ":$" | sed -e 's/:$//' -e 's/[^-][^\/]*\//--/g' -e 's/^/   /' -e 's/-/|/'         

Which produces:

 .                          
 |-docs                     
 |-lib                      
 |-node_modules             
 |---connect-file-cache     
 |-----docs                 
 |-----lib                  
 |-----node_modules         
 |-------mime               
 |-------underscore         
 |-----src                  
 |-----test                 
 |-----test_fixtures        
 |---mime                   
 |---snockets               

That's good, but the files aren't there. My bash scripting skills are weak, so I have no idea how to get the files to show in that output.

Since I'm on Windows, I don't think I can get the tree command into mingw32.

BenjiWiebe
  • 9,173
jcollum
  • 5,402

2 Answers2

4

https://superuser.com/a/359728/5200

added this function to .bash_profile:

function ftree {
    SEDMAGIC='s;[^/]*/;|____;g;s;____|; |;g'

    if [ "$#" -gt 0 ] ; then
       dirlist="$@"
    else
       dirlist="."
    fi

    for x in $dirlist; do
         find "$x" -print | sed -e "$SEDMAGIC"
    done

}

It's not pretty, but it does the job. Credit to https://superuser.com/users/105575/ahmed-masud

jcollum
  • 5,402
0

A tool that will help you with this is Print Maestro. This handy solution will quickly print folder tree after preview.

When you click on some folder in the left-side folder list, you will see all its subfolders listed in the upper right side list. Below it you will find the report mock that will be printed. To the right from the mock there is a list of report types, where you need to check off 'Tree' in Standard tab.

Print Folder Tree