Tree view of directory while using Subversion

J

James E Keenan

Tad McClellan has on a couple of occasions posted the following shell
code as a quick way of generating a tree view of the content of a directory:

find . -print | sed -e 's,[^/]*/\([^/]*\)$,`--\1,' -e 's,[^/]*/,| ,g'

See, for example, http://tinyurl.com/a8mmr.

I've used this many times, but now that I use Subversion a lot, it
generates too much output, because it prints out all the .svn directories.

I hacked on Tad's suggestion and came up with this, which I've placed in
my .bashrc file:

# trim: A trimmer tree
# bypassing all subdirectories whose names begin with '.'
trim ()
{
find . -not -regex '.*/\..*' -print | sed -e
's,[^/]*/\([^/]*\)$,`--\1,' -e 's,[^/]*/,| ,g' | more
}

Comments?

jimk
 
D

Dr.Ruud

James E Keenan:
# trim: A trimmer tree
# bypassing all subdirectories whose names begin with '.'
trim ()
{
find . -not -regex '.*/\..*' -print | sed -e
's,[^/]*/\([^/]*\)$,`--\1,' -e 's,[^/]*/,| ,g' | more
}

Comments?


No Perl involved.


find . -not -name '.*'
| sort
| sed -e 's,[^/]*/\([^/]*\)$,`--\1,' -e 's,[^/]*/,| ,g'
| less

Alternative sed-line:

| sed 's,[^/]*/\([^/]*\)$,+--\1,; s,[^/]*/,| ,g'


Try also:

tree -C | less -R
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top