Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Sat 16 Dec 2017, 20:52
All times are UTC - 4
 Forum index » Advanced Topics » Additional Software (PETs, n' stuff) » Utilities
Come and get them: tree(s)-1.6.0 and 1.7.0 (32-bit & 64 bit)
Post new topic   Reply to topic View previous topic :: View next topic
Page 2 of 3 [34 Posts]   Goto page: Previous 1, 2, 3 Next
Author Message
musher0


Joined: 04 Jan 2009
Posts: 11285
Location: Gatineau (Qc), Canada

PostPosted: Sun 20 Mar 2016, 22:08    Post subject:  

Hello all.

As promised:
Quote:
< tree > command examples using a music collection at /mnt/sda1/Music

First, open a terminal and type < cd /mnt/sda1/Music >
(or wherever your music collection is).
Then do the following exercises to familiarize yourself with the < tree > command.

~~~~~~~~~~~~~~~~~~
Summary

#1 tree (without parameters): outputs all paths and all files with the "tree branches"
< tree >
~~~~~~~~~~~~~~~~~~

#2 tree -d: outputs directories only
< tree -d >
~~~~~~~~~~~~~~~~~~

#3 tree -P parameter. Type
< tree -P '*ogg' >
Gets a listing of paths and files containing "ogg" in them
~~~~~~~~~~~~~~~~~~

#4 tree piped to grep
< tree | grep Vivaldi >
Will give you all paths and files containing the name "Vivaldi" in them.
~~~~~~~~~~~~~~~~~~

#5 tree piped to grep with regex
< tree -if | grep -E "\.ogg$" >

Will give you a listing of files
- ending with the extension ".ogg"
- flush to the left margin,
- with the path
- but without the "tree branches"

Have you noticed the differences between #3, #4 and #5?
The tree command's own "pattern" search (-P "something") is rather crude if you
compare it with piping its results through < grep -E "something" >.
~~~~~~~~~~~~~~~~~~

#6 tree (pseudo-ls listing with "tree branches")

< tree -afhDp >
~~~~~~~~~~~~~~~~~~

#7 tree (pseudo-ls listing without the "branches". Similar to < ls -AlgoR >)

< tree -afhiDp >

Explanation:
-a : all files
-f : full path
-h : human understandable sizes (in Kb's and Mb's rather than only bytes)
-i : no "tree branches". (All files and paths are listed close to the left margin.)
-D : with date
-p : with permissions
~~~~~~~~~~~~~~~~~~

#8 tree -o filename.ext: outputs silently to a text file.

< tree -o ~/tree-P.xmpl -P '*ogg' >
All pathnames and filenames with "ogg" in them will be listed in file
/root/tree-p.xmpl
~~~~~~~~~~~~~~~~~~

#9 tree -H -[some other parameters here]
< tree -o ~/tree-P.html -P '*ogg' -H >
All pathnames and filenames with "ogg" in them will be listed in file
/root/tree-p.html. Similar to #8 above, but in html format, ready to
view in a browser.
~~~~~~~~~~~~~~~~~~
I hope this helps. BFN
_________________
musher0
~~~~~~~~~~
"Logical entities must not be multiplied beyond necessity." | |
« Il ne faut pas multiplier les entités logiques sans nécessité. » (Ockham)
Back to top
View user's profile Send private message 
Flash
Official Dog Handler


Joined: 04 May 2005
Posts: 12722
Location: Arizona USA

PostPosted: Sun 20 Mar 2016, 22:23    Post subject:  

musher0 wrote:
Hi Flash.

You said:
> "tree --help" in a console gets a quick listing, but the options are not well
__ explained. Is there a more complete instruction manual?


Did you miss this post above? Also, This page on the computerhope site
has examples.

I'll try to come up with more real-life examples below.

BFN.

I didn't miss it, I forgot about it in the excitement of finding a tree that works in 64-bit Werewolf. Embarassed
Back to top
View user's profile Send private message 
musher0


Joined: 04 Jan 2009
Posts: 11285
Location: Gatineau (Qc), Canada

PostPosted: Sun 20 Mar 2016, 22:40    Post subject:  

@Flash:

No problem! Smile

I hope the examples I provided above are clear enough.
If you need more examples, just holler!

BFN.

_________________
musher0
~~~~~~~~~~
"Logical entities must not be multiplied beyond necessity." | |
« Il ne faut pas multiplier les entités logiques sans nécessité. » (Ockham)
Back to top
View user's profile Send private message 
Flash
Official Dog Handler


Joined: 04 May 2005
Posts: 12722
Location: Arizona USA

PostPosted: Thu 23 Feb 2017, 09:26    Post subject:  

I'd like to see tree incorporated into ROX-filer's right-click menu. At least, how about a .pet that does that?
Back to top
View user's profile Send private message 
greengeek


Joined: 20 Jul 2010
Posts: 4749
Location: Republic of Novo Zelande

PostPosted: Thu 23 Feb 2017, 13:02    Post subject:  

Flash wrote:
I'd like to see tree incorporated into ROX-filer's right-click menu. At least, how about a .pet that does that?
I have just used tree for the first time. How would you use it from right click menu?

Would you right click on a directory and select "tree" from the rightclick menu and then have a terminal pop up with the output of the tree command showing the contents of that directory? Is that how you see it working?
Back to top
View user's profile Send private message 
greengeek


Joined: 20 Jul 2010
Posts: 4749
Location: Republic of Novo Zelande

PostPosted: Thu 23 Feb 2017, 14:28    Post subject:  

I just had a tinker to see how I could get some value out of tree as a righclick utility. Attached is a pet for a very raw way to use rightclick to get "tree" to list directory contents in leafpad.

If the pet is of no use please uninstall it before shutting down - don't graft it into your savefile in it's current form. Use for testing/criticism only - and preferably in a "ram only" boot.

The pet installs my script called "treepad" into /root/config/rox.sourceforge.net/OpenWith/.inode_directory
treepad_gg-0.1.pet
Description 
pet

 Download 
Filename  treepad_gg-0.1.pet 
Filesize  842 Bytes 
Downloaded  30 Time(s) 
Back to top
View user's profile Send private message 
musher0


Joined: 04 Jan 2009
Posts: 11285
Location: Gatineau (Qc), Canada

PostPosted: Thu 23 Feb 2017, 15:04    Post subject:  

Hi greengeek.

If I may, here's my take on it:
Code:
#!/bin/ash
# musher0, 23 Febr. 2017
# script to run "tree" by right-clicking a directory in a ROX-Filer window
# Dependency: tree
####
> /tmp/treeDir # making sure the recipient is empty
tree "$@" > /tmp/treeDir # dir tree is built
leafpad /tmp/treeDir # dir tree is read

You just need to specify "$@", ROX-Filer does the rest.
No fancy string juggling is needed.

Also, IMO, it is more reliable to save the tree listing to a file and then
ask leafpad to read it, rather than pipe it from tree directly to leafpad.

Respectfully,
treepad(1).JPG
 Description   
 Filesize   75.93 KB
 Viewed   123 Time(s)

treepad(1).JPG

treepad_musher-0.1.pet
Description 
pet

 Download 
Filename  treepad_musher-0.1.pet 
Filesize  578 Bytes 
Downloaded  34 Time(s) 

_________________
musher0
~~~~~~~~~~
"Logical entities must not be multiplied beyond necessity." | |
« Il ne faut pas multiplier les entités logiques sans nécessité. » (Ockham)
Back to top
View user's profile Send private message 
Flash
Official Dog Handler


Joined: 04 May 2005
Posts: 12722
Location: Arizona USA

PostPosted: Thu 23 Feb 2017, 19:55    Post subject:  

greengeek wrote:
Flash wrote:
I'd like to see tree incorporated into ROX-filer's right-click menu.
How would you use it from right click menu?

Would you right click on a directory and select "tree" from the rightclick menu and then have a terminal pop up with the output of the tree command showing the contents of that directory? Is that how you see it working?

That's basically what I had in mind, except no need to specify the directory by right-clicking on it. The contents of the directory ROX is in when you right-click is the one that tree should show. So you'd need to already be in a directory with ROX. But that's only my preliminary thoughts and I'm sure other people will come up with something classier or more elegant or something.

I will say that tree's appearance when displayed in a console leaves a lot to be desired. Perhaps the result could be displayed in a text editor that has a font that looks good. I've saved tree's result as a file before, then opened the file with Geany and edited it to remove the vertical and horizontal lines and display the text with a variable pitch font. Kind of like what musher0 did in his post above, only without the lines, which I find distracting and visually confusing.
Back to top
View user's profile Send private message 
musher0


Joined: 04 Jan 2009
Posts: 11285
Location: Gatineau (Qc), Canada

PostPosted: Thu 23 Feb 2017, 21:34    Post subject:  

@Flash:

Something like this? (Please see pic.)

That's
Code:
tree -afi "$@"
list shown in a less window. With these parms, the path is repeated in
front of every file, though.

Since the less window has an urxvt base, we can easily specify a fancy
font via urxvt, but not in leafpad. The illustration is just an example. If we
follow this route, we can provide any color and contrast as well.

I also suspect that you'd want
Code:
tree -afi $PWD
since you want to call it from the dir itself, and script wise, that's another
can of worms entirely!

BFN.
treepad(2).JPG
 Description   
 Filesize   50.67 KB
 Viewed   84 Time(s)

treepad(2).JPG


_________________
musher0
~~~~~~~~~~
"Logical entities must not be multiplied beyond necessity." | |
« Il ne faut pas multiplier les entités logiques sans nécessité. » (Ockham)
Back to top
View user's profile Send private message 
Flash
Official Dog Handler


Joined: 04 May 2005
Posts: 12722
Location: Arizona USA

PostPosted: Thu 23 Feb 2017, 22:46    Post subject:  

If right-clicking in the ROX window of a directory to call tree would make your script less elegant or more complicated, then I'm fine with not doing it that way. It's not that big a deal, I just thought it might be a good way to go.

As for your picture, it appears that removing the lines also removed the indentation. I like indentation. The end result should look like an outline, in my opinion. "tree -d" already does, except for those pesky lines. Whose idea were they, anyway? Smile
Back to top
View user's profile Send private message 
musher0


Joined: 04 Jan 2009
Posts: 11285
Location: Gatineau (Qc), Canada

PostPosted: Thu 23 Feb 2017, 22:54    Post subject:  

Just a thought, Flash...

Maybe using Midnight Commander in tree mode would bring you closer to
what you want, instead of torturing ROX-Filer with scripts!

I just made the most recent version of mc available here.

Some other FMs have a tree mode, such as
XFE -- http://roland65.free.fr/xfe/index.php?page=screenshots
emelfm2 -- http://emelfm2.net/wiki/ScreenShots
three others -- http://askubuntu.com/questions/339125/is-there-a-linux-file-manager-with-a-proper-drop-down-tree-view-like-finder-in
16 "best" FMs -- https://www.slant.co/topics/2090/~linux-file-managers
mc-tree_view(1).JPG
 Description   Example of mc used in tree mode. The tree is in the right panel and the files
show up in the left panel.
 Filesize   54.56 KB
 Viewed   74 Time(s)

mc-tree_view(1).JPG


_________________
musher0
~~~~~~~~~~
"Logical entities must not be multiplied beyond necessity." | |
« Il ne faut pas multiplier les entités logiques sans nécessité. » (Ockham)

Last edited by musher0 on Thu 23 Feb 2017, 23:06; edited 1 time in total
Back to top
View user's profile Send private message 
musher0


Joined: 04 Jan 2009
Posts: 11285
Location: Gatineau (Qc), Canada

PostPosted: Thu 23 Feb 2017, 22:59    Post subject:  

Flash wrote:
If right-clicking in the ROX window of a directory to call tree would make your script less elegant or more complicated, then I'm fine with not doing it that way. It's not that big a deal, I just thought it might be a good way to go.

As for your picture, it appears that removing the lines also removed the indentation. I like indentation. The end result should look like an outline, in my opinion. "tree -d" already does, except for those pesky lines. Whose idea were they, anyway? Smile

At the top right of this page: http://mama.indstate.edu/users/ice/tree/,
you can e-mail your dissatisfaction to the man! Laughing

_________________
musher0
~~~~~~~~~~
"Logical entities must not be multiplied beyond necessity." | |
« Il ne faut pas multiplier les entités logiques sans nécessité. » (Ockham)

Last edited by musher0 on Thu 23 Feb 2017, 23:04; edited 1 time in total
Back to top
View user's profile Send private message 
musher0


Joined: 04 Jan 2009
Posts: 11285
Location: Gatineau (Qc), Canada

PostPosted: Thu 23 Feb 2017, 23:03    Post subject:  

@Flash again

Unfortunately with the tree utility, your preferred option is not available!

You either have:
the ANSI lines,
the full path
OR
nothing at all, only the file specs. This last option is useless, of course,
since you don't know in which dir the file is.

BFN.

_________________
musher0
~~~~~~~~~~
"Logical entities must not be multiplied beyond necessity." | |
« Il ne faut pas multiplier les entités logiques sans nécessité. » (Ockham)
Back to top
View user's profile Send private message 
Flash
Official Dog Handler


Joined: 04 May 2005
Posts: 12722
Location: Arizona USA

PostPosted: Thu 23 Feb 2017, 23:05    Post subject:  

The file managers I've tried that have tree modes don't show in outline form all the directories that are contained in the top directory like tree does. At least, I couldn't think of a way to make them do it. Instead, they all show only the next level down of directories. You have to click on or open each of those directories to see if it contains directories, etc.. What I'm trying to describe is difficult for me to explain. I hope I managed it.

Okay, well, I was able to get what I wanted by saving the output of tree as a file, then opening the file with Geany and editing it.
Back to top
View user's profile Send private message 
musher0


Joined: 04 Jan 2009
Posts: 11285
Location: Gatineau (Qc), Canada

PostPosted: Thu 23 Feb 2017, 23:42    Post subject:  

Hello again Flash.

Here's another experiment using
Code:
ls -AlR1 "$@"
Who knows? Someone may like it! Wink

BFN
lsRpad-0.1.pet
Description 
pet

 Download 
Filename  lsRpad-0.1.pet 
Filesize  563 Bytes 
Downloaded  28 Time(s) 
lsRpad.JPG
 Description   Result.
 Filesize   45.4 KB
 Viewed   53 Time(s)

lsRpad.JPG


_________________
musher0
~~~~~~~~~~
"Logical entities must not be multiplied beyond necessity." | |
« Il ne faut pas multiplier les entités logiques sans nécessité. » (Ockham)
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 2 of 3 [34 Posts]   Goto page: Previous 1, 2, 3 Next
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Advanced Topics » Additional Software (PETs, n' stuff) » Utilities
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0655s ][ Queries: 14 (0.0111s) ][ GZIP on ]