Tree view of directory while using Subversion

Discussion in 'Perl Misc' started by James E Keenan, Nov 13, 2005.

  1. 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
     
    James E Keenan, Nov 13, 2005
    #1
    1. Advertising

  2. James E Keenan

    Dr.Ruud Guest

    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."
     
    Dr.Ruud, Nov 13, 2005
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Stub

    B tree, B+ tree and B* tree

    Stub, Nov 12, 2003, in forum: C Programming
    Replies:
    3
    Views:
    10,182
  2. raki
    Replies:
    1
    Views:
    1,169
    Alexey Smirnov
    Jun 24, 2009
  3. Replies:
    5
    Views:
    766
    John B. Matthews
    Apr 30, 2010
  4. Replies:
    0
    Views:
    375
  5. Parthiv Joshi
    Replies:
    1
    Views:
    753
    Samuel L Matzen
    Jul 6, 2004
Loading...

Share This Page