Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Perl Misc (http://www.velocityreviews.com/forums/f67-perl-misc.html)
-   -   Tree view of directory while using Subversion (http://www.velocityreviews.com/forums/t895140-tree-view-of-directory-while-using-subversion.html)

James E Keenan 11-13-2005 04:59 PM

Tree view of directory while using Subversion
 
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

Dr.Ruud 11-13-2005 07:14 PM

Re: Tree view of directory while using Subversion
 
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."


All times are GMT. The time now is 06:59 AM.

Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.