Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Display a tree-like structural view of any directory' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Display a tree-like structural view of any directory
Authored by: os4 on Feb 15, '06 07:16:30AM

What we really need is a Finder add-on (or may another view option, Apple?!) that provides the tree navigation like in Windows explorer. This is one of the very few features of Windows that I believe is superior to the options available right now in the Finder.

I am surprised that someone has not figure out how to hack the Finder app to make the sidebar the tree nav, or at least some type of "drawer" widget attached to Finder windows that provides this navigation.



[ Reply to This | # ]
Path Finder
Authored by: badger brigade on Feb 15, '06 07:54:14AM

Path Finder gives you an outline view, which isn't like the tree view in Windows - it's more like the outline view in Mac OS 9 - but it essentially achieves the same thing.



[ Reply to This | # ]
Outline mode
Authored by: gerwitz on Feb 15, '06 08:20:02AM

How is that different than List View in OS X?



[ Reply to This | # ]
Outline mode
Authored by: solipsism on Feb 15, '06 05:09:55PM

I'm wondering that too.



[ Reply to This | # ]
Outline mode
Authored by: jacobolus on Feb 15, '06 05:15:44PM

it's not



[ Reply to This | # ]
Outline mode
Authored by: badger brigade on Feb 16, '06 03:25:31PM

You're right, it's not. Strange, I guess I'd just never used List View that way before. Maybe having Path Finder fill the whole screen (versus small Finder windows) makes browsing that way more inviting.



[ Reply to This | # ]
Display a tree-like structural view of any directory
Authored by: wgscott on Feb 15, '06 08:21:44AM
I just came up with a truly cheesy way to use the output from tree as an interface to the finder. The tree command gives the output as html. If you open an html file in safari (it would be much better to pipe to it, but I can't figure out how), and click the url to a file on disk, it opens a finder window and highlights the file, rather than opening it in safari. I've always found that behavior irritating, but in this case it can be put to advantage.

It is a truly ugly hack, but maybe someone can make it more elegant.

cd to your top directory of choice, then issue

tree -H rmtag | perl -p -e 's|rmtag/||g' >| junk.html ; \
open junk.html ; \
sleep 6 ; \
/bin/rm -f junk.html
The sleep command gives safari some time to open the file before it gets deleted. It would be much nicer to pipe into safari the output of tree than to do this.

[ Reply to This | # ]
Display a tree-like structural view of any directory
Authored by: jdv on Feb 15, '06 08:42:53AM
You should check out this hint...

[ Reply to This | # ]
Display a tree-like structural view of any directory
Authored by: GlowingApple on Feb 15, '06 07:42:42PM

This creates a temporary file just as the above does (though it's handled by the open command, so there's not worry about a wait time and having to clean up the file afterward.

Problem is that the temp file is created by default with a .txt extension, so when Safari opens it, the code is displayed as a text file, but never rendered as it does with a .html extension.

---
Jayson --When Microsoft asks you, "Where do you want to go today?" tell them "Apple."



[ Reply to This | # ]
Display a tree-like structural view of any directory
Authored by: GlowingApple on Feb 15, '06 08:30:13PM
I couldn't get the perl command to work. The top of the tree shows rmtag as the text still. I'm guessing the / after the rmtag is a typo? In any case, I would prefer to have the top of the tree list the full path of the directory in which tree is working:
tree -H rmtag | perl -p -e "s|rmtag|`pwd`|g" >| junk.html ; \
open junk.html ; sleep 6 ; /bin/rm -f junk.html

---
Jayson --When Microsoft asks you, "Where do you want to go today?" tell them "Apple."

[ Reply to This | # ]

Display a tree-like structural view of any directory
Authored by: ra5ul on Feb 15, '06 10:02:03PM
there's just a backslash missing:
tree -H x | sed 's/x\///' ...

you can get this to work in elinks (any probably other text browsers) with:
tree -aH `pwd` | elinks -force-html

as for safari, it doesn't always open local files in the finder (e.g. *.js, *.pl, *.py open fine on 2.0.3). it seems to be restricted to directories and files it would normally download instead of displaying. there should be a way to specify these files (either in safari's Info.plist or through launchservices), but i don't know how.

[ Reply to This | # ]

!!!
Authored by: ra5ul on Feb 15, '06 10:05:34PM
tree -H x | sed 's/x\///' ... ridiculous.

[ Reply to This | # ]
Display a tree-like structural view of any directory
Authored by: wgscott on Feb 15, '06 10:05:44PM
That actually makes it cleaner. Just do this:

tree -H $PWD > junk.html ; open junk.html ; sleep 6 ; /bin/rm -f junk.html

The other was just designed to trim the ./ from the front of the path. This instead appends the true full path, so it is unambiguous as well as much cleaner. Now if only I could pipe it.

[ Reply to This | # ]
Display a tree-like structural view of any directory
Authored by: wgscott on Feb 15, '06 10:09:08PM
Or even this:

tree -H $PWD > /tmp/$$junk.html ; open /tmp/$$junk.html

[ Reply to This | # ]
Display a tree-like structural view of any directory
Authored by: starwxrwx on Feb 16, '06 12:47:11AM

agreed - great suggestion.

the 'windows explorer' navigation window is the best way to move files around. I love the finder column view generally, but it makes moving files a pain if you have to go up and then down the directory structure, and list view generally takes up too much of the window and again you have to wait to scroll and spring load folders. urg.



[ Reply to This | # ]