custom tree command using find

You can added the following to ~/.bash_profile for use in Terminal.app. Some comments are included to help remember how find is being used.

##########
## tree ##
##########
## example ...
#|____Cycles
#| |____.DS_Store
#| |____CyclesCards.json
#| |____Carbon
#| | |____Carbon.json
# alternate: alias tree='find . -print | sed -e "s;[^/]*/;|____;g;s;____|; |;g"'
# use$ tree ; tree . ; tree [some-folder-path]
function tree {
    find ${1:-.} -print | sed -e 's;[^/]*/;|____;g;s;____|; |;g'
}

http://superuser.com/questions/359723/mac-os-x-equivalent-of-the-ubuntu-tree-command

Here is an example, where I am using tree command to see how application is spread across files.

(fab)SDS% tree app | grep -v ".pyc"
app
|______init__.py
|____forms.py
|____index.py
|____models.py
|____static
| |____css
| | |____fullcalendar.css
| | |____fullcalendar.print.css
| |____img
| |____js
| | |____fullcalendar.min.js
| | |____jquery.min.js
| | |____moment.min.js
|____templates
| |____404.html
| |____base.html
| |____help.html
| |____my_index.html
| |____new.html
| |____test.html
|____translations
| |____pt
| | |____LC_MESSAGES
| | | |____messages.mo
| | | |____messages.po
|____views.py

Source: http://superuser.com/questions/359723/mac-os-x-equivalent-of-the-ubuntu-tree-command

Advertisements