Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > Tree view of directory while using Subversion

Reply
Thread Tools

Tree view of directory while using Subversion

 
 
James E Keenan
Guest
Posts: n/a
 
      11-13-2005
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
 
Reply With Quote
 
 
 
 
Dr.Ruud
Guest
Posts: n/a
 
      11-13-2005
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

--
Affijn, Ruud

"Gewoon is een tijger."
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting 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
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Free Online Subversion Training - All About Subversion Hook Scripts george.powell@wandisco.com Java 0 05-12-2010 09:43 AM
Free Online Subversion Training - Introduction to Subversion forDevelopers george.powell@wandisco.com Java 5 04-30-2010 02:57 AM
abt tree view in asp.net can i hide the tree nodes ? raki ASP .Net 1 06-24-2009 11:45 AM
How to make a week view and day view calendar just like month view calendar in .NET ? Parthiv Joshi ASP .Net Web Controls 1 07-06-2004 03:15 PM
B tree, B+ tree and B* tree Stub C Programming 3 11-12-2003 01:51 PM



Advertisments