Normal Linux commands to Locate your system files, INSTANTLY

Using applications, configuring, problems
Message
Author
User avatar
RetroTechGuy
Posts: 2947
Joined: Tue 15 Dec 2009, 17:20
Location: USA

#121 Post by RetroTechGuy »

musher0 wrote:Hello, bunch! :)

Speaking of useful cli programs missing in Puppy, there's tree, which Puppus
mentioned here :
http://murga-linux.com/puppy/viewtopic. ... ost#830366
With pretty fancy parameters, he created a full index of files on his computer.

BFN.

musher0
I like "tree". I use "tree -idf" which produces a "bare" format tree, perfect for using in batch files (I use the output list to build a script to cull empty folders from the system -- helps me locate things, when I don't have empties laying everywhere...)

I just pulled it from the Debian bundle -- under Lupu, there were no missing dependencies, or extra things needed,
[url=http://murga-linux.com/puppy/viewtopic.php?t=58615]Add swapfile[/url]
[url=http://wellminded.net63.net/]WellMinded Search[/url]
[url=http://puppylinux.us/psearch.html]PuppyLinux.US Search[/url]

amigo
Posts: 2629
Joined: Mon 02 Apr 2007, 06:52

#122 Post by amigo »

mikeb, it's gtkdialog which is using locate to look for icons. It's pretty lame, and I think that goingnuts and/or I wrote that out for gtkdialog1 -in favor of looking directly in normal 'sane' locations.

User avatar
mikeb
Posts: 11297
Joined: Thu 23 Nov 2006, 13:56

#123 Post by mikeb »

mikeb, it's gtkdialog which is using locate to look for icons. It's pretty lame, and I think that goingnuts and/or I wrote that out for gtkdialog1 -in favor of looking directly in normal 'sane' locations.
ah ok....I thought I had seen something else do it but it was a long time ago.

As it happens gtkdialog appears to be calling a deprecated glib function which throws up constant errors with combo boxes in Lucid and newer...so perhaps a recompile would be generally a good move.

And yes... items in standard locations help. In this case they were simply not added yet as was testing.

mike

amigo
Posts: 2629
Joined: Mon 02 Apr 2007, 06:52

#124 Post by amigo »

'standard locations', I had appended the following to the last sentence: "but that won't help much with Puppy", but then erased it. You can probably still see the eraser marks...

User avatar
mikeb
Posts: 11297
Joined: Thu 23 Nov 2006, 13:56

#125 Post by mikeb »

living in the here and now :)

mike

slavvo67
Posts: 1610
Joined: Sat 13 Oct 2012, 02:07
Location: The other Mr. 305

#126 Post by slavvo67 »

Actually, by the time I read this.. you're here and now is already the past..... So, you're actually living in the past??

User avatar
mikeb
Posts: 11297
Joined: Thu 23 Nov 2006, 13:56

#127 Post by mikeb »

I relooked at the gtkdialog sources...yes was removed indeed...I forgot it was used several times in the countrywizard and I only changed one instance lol ..gtkdialog for pop up messages..way to overkill. blond moment....

As for those combobox errors its a pile of gtk shite...they changed the function calls and methods 3 times in a couple of years...no one could keep up with that sort of crap behaviour...so ignore the errors time...or rebuild glib to not spew them out lol.

mike

User avatar
Uten
Posts: 129
Joined: Tue 29 Jan 2008, 11:00

#128 Post by Uten »

Another find I stumbled upon while browsing for something else. This "trick" explains how to build a locate db of your cd collection. It does so by creating the locate.db by hand rather than using updatedb. It lets you add a short unique name to each cd file collection.

stemsee

#129 Post by stemsee »

How about using wildcards to search slocate database and listing selectable results in a yad gui?

This example for *.mp3 search.

Code: Select all

#!/bin/sh
filext=`yad --title="Find files" --text="What are you looking for?:
e.g. *.mp3" \
--form \
--field="Type file name or extension:"`
filext=`echo "$filext" | cut -f1 -d '|'`
select=$(for f in `slocate "$filext"`; do echo $f ; done | yad --list --multiple --center --height="400" --column="App Icons:" --print-column="1" --separator=" ")
ret=$?
[[ $ret -eq 1 ]] && exit 0
if [[ $ret -eq 0 ]]; then
vlc $select &
fi
need to invoke mimetype associations somewho to use the result with the right app.

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#130 Post by musher0 »

stemsee wrote:How about using wildcards to search slocate database and listing selectable results in a yad gui?

This example for *.mp3 search.

Code: Select all

#!/bin/sh
filext=`yad --title="Find files" --text="What are you looking for?:
e.g. *.mp3" \
--form \
--field="Type file name or extension:"`
filext=`echo "$filext" | cut -f1 -d '|'`
select=$(for f in `slocate "$filext"`; do echo $f ; done | yad --list --multiple --center --height="400" --column="App Icons:" --print-column="1" --separator=" ")
ret=$?
[[ $ret -eq 1 ]] && exit 0
if [[ $ret -eq 0 ]]; then
vlc $select &
fi
need to invoke mimetype associations somewho to use the result with the right app.
Hi, stemsee.

Does that work? slocate uses sort of "piling up plus differential"
references in its db to keep it small. Does your script expand those
"references" into human-readable lines?

I mean:
slocate can decipher its own db lines and present the result to the user in
a readable form, but can an external program such as yad do it?

Maybe a screen cap would help me understand. Thanks in advance.

Best regards.

musher0
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#131 Post by musher0 »

Uten wrote:Another find (...)
Interesting page!
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

stemsee

#132 Post by stemsee »

Corrected code. If you select several files in this case mp3 files they will be listed in vlc ie queue list. Just needs a function to select app per extension. If $select = *.mp3 open $app. etc

Could seperate dirname and basename fields for easier display in yad list.

Code: Select all

#!/bin/sh 
filext=`yad --title="Find files" --text="What are you looking for?: 
e.g. *.mp3" --form --field="Type file name or extension:" `
filext=`echo "$filext" | cut -f1 -d '|'` 
select=$(for f in `slocate "$filext"`; do echo $f ; done | yad --list --multiple --center --height="400" --column="$filext:" --print-column="1" --separator=" ") 
ret=$? 
[[ $ret -eq 1 ]] && exit 0 
if [[ $ret -eq 0 ]]; then 
vlc $select & 
fi
Attachments
capture24731.jpg
(9.76 KiB) Downloaded 162 times
capture25671.jpg
(29.25 KiB) Downloaded 164 times
Last edited by stemsee on Tue 31 Mar 2015, 09:53, edited 1 time in total.

stemsee

#133 Post by stemsee »

Ok, made another yad list of desktop files to select app to open file/s. Now just needs someone to combine these three yad gui elements into one dynamic gui. Then slocate wil have its own gui.

It would be nice to search a name and then select several files with different extensions and have them each open with the correct app automatically. I have no clue how to achieve that simply!?

Code: Select all

#!/bin/sh 
filext=`yad --title="Find files" --text="What are you looking for?: 
e.g. *.mp3" --form --field="Type file name or extension:" `
filext=`echo "$filext" | cut -f1 -d '|'` 
select=$(for f in `slocate "$filext"`; do echo $f ; done | yad --list --multiple --center --height="400" --column="$filext:" --print-column="1" --separator=" ") 
ret=$? 
[[ $ret -eq 1 ]] && exit 0 
if [[ $ret -eq 0 ]]; then
app=$(for f in `ls /usr/share/applications`; do echo $f | cut -f1 -d '.' ; done | yad --list --multiple --center --height="400" --column="Select app to open $filext:" --print-column="1" --separator=" ") 
ret=$?
$app $select & 
fi
Attachments
capture4265.jpg
(38.02 KiB) Downloaded 154 times

stemsee

#134 Post by stemsee »

Of course on EmSee-Ultra the app list is unmanageable! Better to link the most useful apps into some dir and list that in yad, for speed and manageability.

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#135 Post by musher0 »

Thanks for your hours of hard work, stemsee.
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

stemsee

#136 Post by stemsee »

??
are you being sarcastic musher0 ?

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#137 Post by musher0 »

stemsee wrote:??
are you being sarcastic musher0 ?
Not at all my intention. Please forgive me if it looks like that.

Simply, I looked at the posting time of your recent messages and deducted
logically that you must've spent many hours working on your script before
telling us about it.

Also, I didn't have time to comment further, I had to go out in a hurry after
supper tonight, and my short message came out badly. Again, sorry.

Now I owe you at least some thorough testing to earn your forgiveness. :)
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

stemsee

#138 Post by stemsee »

Well, it took ten minutes or so to come up with that script, after having the idea! It took longer to organise the screenshots. And none of it is what I would call hard work.

So, i hope you can develop this into something useful.

stemsee

#139 Post by stemsee »

test this. It also helps the user create a custom list of linked apps for use with slocategui.


Code: Select all

#!/bin/sh
if [ ! -f /root/.slocateguiflag ]; then
mkdir /usr/share/slgapps
yad --text "Now select the apps you regularly use to open files.\nThese will be linked to their own special directory \n to speed up slocategui."
lapps=$(for f in `ls /usr/share/applications`; do echo $f | cut -f1 -d '.' ; done | yad --list --multiple --center --height="400" --column="$filext:" --print-column="1" --separator=" ") 
ret=$?
for file in $lapps
do
ls /usr/share/applications | grep -e $file | ln -s $file /usr/share/slgapps/$file
done
touch /root/.slocateguiflag
filext=`yad --title="Find files" --text="What are you looking for?: 
e.g. *.mp3" --form --field="Type file name or extension:" `
filext=`echo "$filext" | cut -f1 -d '|'` 
select=$(for f in `slocate "$filext"`; do echo $f ; done | yad --list --multiple --center --height="400" --column="$filext:" --print-column="1" --separator=" ") 
ret=$? 
[[ $ret -eq 1 ]] && exit 0 
if [[ $ret -eq 0 ]]; then
app=$(for f in `ls /usr/share/slgapps`; do echo $f | cut -f1 -d '.' ; done | yad --list --center --height="400" --column="$filext:" --print-column="1" --separator=" ") 
ret=$?
$app $select & 
fi
else
filext=`yad --title="Find files" --text="What are you looking for?: 
e.g. *.mp3" --form --field="Type file name or extension:" `
filext=`echo "$filext" | cut -f1 -d '|'` 
select=$(for f in `slocate "$filext"`; do echo $f ; done | yad --list --multiple --center --height="400" --column="$filext:" --print-column="1" --separator=" ") 
ret=$? 
[[ $ret -eq 1 ]] && exit 0 
if [[ $ret -eq 0 ]]; then
app=$(for f in `ls /usr/share/slgapps`; do echo $f | cut -f1 -d '.' ; done | yad --list --center --height="400" --column="$filext:" --print-column="1" --separator=" ") 
ret=$?
$app $select & 
fi
fi

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#140 Post by musher0 »

Hi, stemsee.

Feedback (un-finished !) with some code formatting and a couple of
comments :

Code: Select all

#!/bin/sh 
# gui for slocate searches
# by stemsee, 
# murga-linux.com/puppy/viewtopic.php?p=837640&sort=lastpost#837640 
# Retrieved 01.04.2015 16:54
#### 
 if [ ! -f /root/.slocateguiflag ]; then 
	mkdir /usr/share/slgapps 
	yad --text "Now select the apps you regularly use to open files.\nThese will be linked to their own special directory \n to speed up slocategui." 
	lapps=$(for f in `ls /usr/share/applications`; do echo $f | cut -f1 -d '.' ; done | yad --list --multiple --center --height="400" --column="$filext:" --print-column="1" --separator=" ") 
	ret=$? 
	for file in $lapps 
		do 
		ls /usr/share/applications | grep -e $file | ln -s $file /usr/share/slgapps/$file 
		done 
	touch /root/.slocateguiflag 
	filext=`yad --title="Find files" --text="What are you looking for?: 
	e.g. *.mp3" --form --field="Type file name or extension:" ` 
	filext=`echo "$filext" | cut -f1 -d '|'` 
	select=$(for f in `slocate "$filext"`; do echo $f ; done | yad --list --multiple --center --height="400" --column="$filext:" --print-column="1" --separator=" ")
# -=> In which slocate db should we be looking? <=- 
	ret=$? 
	[[ $ret -eq 1 ]] && exit 0 
	if [[ $ret -eq 0 ]]; then 
		app=$(for f in `ls /usr/share/slgapps`; do echo $f | cut -f1 -d '.' ; done | yad --list --center --height="400" --column="$filext:" --print-column="1" --separator=" ") 
		ret=$? 
		$app $select & 
	fi 
else 
	filext=`yad --title="Find files" --text="What are you looking for?: 
	e.g. *.mp3" --form --field="Type file name or extension:" ` 
	filext=`echo "$filext" | cut -f1 -d '|'` 
	select=$(for f in `slocate "$filext"`; do echo $f ; done | yad --list --multiple --center --height="400" --column="$filext:" --print-column="1" --separator=" ") 
	ret=$? 
	[[ $ret -eq 1 ]] && exit 0 
	
	if [[ $ret -eq 0 ]]; then 
		app=$(for f in `ls /usr/share/slgapps`; do echo $f | cut -f1 -d '.' ; done | yad --list --center --height="400" --column="$filext:" --print-column="1" --separator=" ") 
		ret=$? 
		$app $select & 
	fi 
 fi
Of course, re-format / re-edit at will, it's your code.

Questions:
As to the "document" file: I get empty fields because -- I think -- the
slocate db is not specified. My implementation is here:
http://murga-linux.com/puppy/viewtopic. ... =736391601
It creates one slocate db per partition. Example:

Image

As to the "executable" : why can we not use the mime-types and ROX to
launch for ex. so-and-so.mp3 ?

Still on it. BFN.

musher0
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

Post Reply