Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Applications > Finder Table of Contents

Finder Table of Contents
Thread Tools
taldrich
Junior Member
Join Date: Nov 2002
Location: London
Status: Offline
Reply With Quote
Nov 10, 2008, 03:48 AM
 
I have just sent a CD of data to someone that contains many folders and sub-folders. I also allow remote users to view this data remotely as a Workgroup on our server. I am continuously updating and adding to this data.

Is there any software utility that can create a Table of Contents, so that a user can see in one glance what is there, without having to dig around?

Thanks
"most people are fools, most authority is malignant, god does not exist and everything is wrong" - Ted Nelson
     
Hal Itosis
Grizzled Veteran
Join Date: Mar 2004
Status: Offline
Reply With Quote
Nov 10, 2008, 04:18 PM
 
Get TextWrangler (or BBEdit Lite) and drag the folder (or disk) into an empty text window.
[might need to edit out hidden files & folders that aren't intended for user consumption.]
-HI-
     
mduell
Posting Junkie
Join Date: Oct 2005
Location: Houston, TX
Status: Offline
Reply With Quote
Nov 11, 2008, 12:12 AM
 
ls will do what you want.
     
Hal Itosis
Grizzled Veteran
Join Date: Mar 2004
Status: Offline
Reply With Quote
Nov 11, 2008, 02:01 AM
 
Originally Posted by mduell View Post
ls will do what you want.
So will mtree

But neither will be as easy to read (i.e., *look* like a TOC) as much as
the results from those BareBones apps (which indent folder sublevels).

[actually, mtree -i does indent... but it's not as pretty.]
-HI-
     
taldrich  (op)
Junior Member
Join Date: Nov 2002
Location: London
Status: Offline
Reply With Quote
Nov 12, 2008, 08:22 AM
 
Thanks - I ended up with TextWrangler which did the job fine. The result has a fairly industrial look to it, but it does the job.
"most people are fools, most authority is malignant, god does not exist and everything is wrong" - Ted Nelson
     
Hal Itosis
Grizzled Veteran
Join Date: Mar 2004
Status: Offline
Reply With Quote
Nov 12, 2008, 07:10 PM
 
I got interested enough in having something like this easily available in Terminal
that I whipped up a small shell script to filter out some of the heavy-duty extras
in mtree's (power-packed) output. Applying a few filters with sed and awk have
made it fairly usable. (save as a file, do chmod a+x, and customize to your taste):


#!/bin/bash
IFS=$' \t\n'
PATH=/bin:/usr/bin
export PATH
folder=${1:-${PWD}}; [[ -d $folder ]] || exit 1
/usr/sbin/mtree -nice -k '' -p "$folder" |
sed 's:^/set::;s: *type=[^ ]*::g;s:\\040: :g;s:^ *..$::' |
awk 'NF != 0 { print }' |awk '$0 !~ /.DS_Store/ { print }'
exit $?



Example (as run on Leopard) with script named "ltr":
Code:
ltr /Library/Perl . 5.8.8 AppendToPath darwin-thread-multi-2level \ SNMP.pm Bundle Makefile.subs.pl NetSNMP ASN.pm OID.pm TrapReceiver.pm agent.pm default_store.pm agent Support.pm default_store.pm netsnmp_request_infoPtr.pm auto Bundle NetSNMP .packlist NetSNMP ASN ASN.bs ASN.bundle autosplit.ix OID OID.bs OID.bundle autosplit.ix TrapReceiver TrapReceiver.bs TrapReceiver.bundle autosplit.ix agent agent.bs agent.bundle autosplit.ix default_store autosplit.ix default_store.bs default_store.bundle default_store autosplit.ix default_store.bs default_store.bundle SNMP SNMP.bs SNMP.bundle autosplit.ix
Still has some junk in the output (mostly trailing spaces).
-HI-
     
Hal Itosis
Grizzled Veteran
Join Date: Mar 2004
Status: Offline
Reply With Quote
Nov 15, 2008, 05:17 PM
 
Originally Posted by Hal Itosis View Post
sed 's:^/set::;s: *type=[^ ]*::g;s:\\040: :g;s:^ *..$::' |
Slight error in line 7 there. Technically, it should be:

sed 's:^/set::;s: *type=[^ ]*::g;s:\\040: :g;s:^ *\.\.$::' |

(it worked as written nonetheless, due to the way mtree adds trailing spaces to certain items).


Heck with it, here's a version that strips the trailing spaces (and might be easier to read):
Code:
#!/bin/bash IFS=$' \t\n' PATH=/usr/bin export PATH folder=${1:-${PWD}}; [[ -d $folder ]] || exit 1 /usr/sbin/mtree -nice -k '' -p "$folder" | sed 's:^/set:: s: *type=[^ ]*:: s:^ *\.\.$:: s: *$:: s:\\040: :g /^$/d /.DS_Store/d' exit $?
( Last edited by Hal Itosis; Nov 15, 2008 at 10:53 PM. Reason: simplify by eliminating awk)
-HI-
     
   
 
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Top
Privacy Policy
All times are GMT -4. The time now is 01:22 AM.
All contents of these forums © 1995-2017 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.8 © 2000-2017, Jelsoft Enterprises Ltd.,