Trying to send Gtk-find search result to ROX-filer [SOLVED]

Booting, installing, newbie
Post Reply
Message
Author
User avatar
zigbert
Posts: 6621
Joined: Wed 29 Mar 2006, 18:13
Location: Valåmoen, Norway
Contact:

Trying to send Gtk-find search result to ROX-filer [SOLVED]

#1 Post by zigbert »

In Gtk-find there is a choice to run a shell command on each search-result. I want to link every result to a hardlink in my home directory.

Gtk-find have a register \0 that stores the filename for every match.

I search and give the shell command "ln \0 /root/tmp/".

Yes it works, but not if filename contains spaces.

Gtk-find finds filenames with spaces and print them, but not when running my shell-command.

Do anybody have some ideas. Puppysearch 1.0 does exactly what I'm asking for, but has very limited search-functions.
Last edited by zigbert on Sat 24 Jun 2006, 21:01, edited 1 time in total.

User avatar
MU
Posts: 13649
Joined: Wed 24 Aug 2005, 16:52
Location: Karlsruhe, Germany
Contact:

#2 Post by MU »

ln "\0" /root/tmp/
might work?
Did not try myself.
Mark

User avatar
zigbert
Posts: 6621
Joined: Wed 29 Mar 2006, 18:13
Location: Valåmoen, Norway
Contact:

#3 Post by zigbert »

I did try the "\0". - Didn't work. The "\0" is then treated as a string, while \0 is a variable.

Thank you Mark for feedback.
BTW - How did you manage it in Puppysearch 1.0. I guess it is a wxbasic application. As far as I know wxbasic doesn't have filemanaging commands without using shell commands?????

John Doe
Posts: 1681
Joined: Mon 01 Aug 2005, 04:46
Location: Michigan, US

#4 Post by John Doe »

Is there any way to replace the space in the \0 var with an escape sequence that will be recognized as a space in the shell?

Like using %25 in a URL?

So one could do something like:
sed 's/ /%25;/g' \0 |

User avatar
MU
Posts: 13649
Joined: Wed 24 Aug 2005, 16:52
Location: Karlsruhe, Germany
Contact:

#5 Post by MU »

Code: Select all

BTW - How did you manage it in Puppysearch 1.0. 
There you can contacenate strings.

linkname = replace ( thefoundfile , "/" , "#")

shell ( "ln -s \"" & thefoundfile & "\" \"/tmp/puppysearch/" & linkname & "\"" )

So you can embed the " by adding a masking \

This also works in shellscripts, but I don't know it gtkfind allows it.

Try
ln -s \"\0\" /root/tmp/

Mark

User avatar
MU
Posts: 13649
Joined: Wed 24 Aug 2005, 16:52
Location: Karlsruhe, Germany
Contact:

#6 Post by MU »

if you want to search more detailed in Puppysearch, use this tweak:

open
/usr/local/Puppy-search/resource/search.pb in an editor.

Line 42 contains the shellcommand find:

mycmd = "rxvt -title \"psearch\" +sb -cr yellow -bg yellow -geometry 30x4+20+20 -e bash -c \"echo wait, searching...&&find " & FOLDER & " -type f " & follow & " -iname \\\"*" & SEARCHSTRING & "*" & FILETYPE & "\\\">/tmp/psearch.tmp 2>/dev/null\""

important is this:
&&find " & FOLDER & " -type f "

Here you could add any option for find, like:
&&find " & FOLDER & " -type f -mtime -2 "

This would show only files from the last 2 days, if I read this (german) overview right:
http://nafoku.de/t/unix.htm

This is of course no solution for every-day use, but if you need Puppysearch only to backup new files, it might be a usefull solution.

Mark

User avatar
zigbert
Posts: 6621
Joined: Wed 29 Mar 2006, 18:13
Location: Valåmoen, Norway
Contact:

#7 Post by zigbert »

Thanks for reply!
sed 's/ /%25;/g' \0 |
I think this could be a sort of solution, but it is still not working.
For me it looks like sed expects \0 to be a file. If I find Gtk-finds output file (which I have not yet found) I could maybe use this file instead of the variable \0.

MU
I am thankful for your knowledge. Maybe the best solution is to search directly with the command find, and then link it.

User avatar
zigbert
Posts: 6621
Joined: Wed 29 Mar 2006, 18:13
Location: Valåmoen, Norway
Contact:

#8 Post by zigbert »

A strange behavior.

When I make a symbolic link in terminal everything is normal. Trying to "ln -s" in Gtk-find makes a defect link.

MU's proposal:
ln -s \"\0\" /root/tmp/
Sadly it didn't make any effect.

User avatar
zigbert
Posts: 6621
Joined: Wed 29 Mar 2006, 18:13
Location: Valåmoen, Norway
Contact:

#9 Post by zigbert »

Gtk-find gave me in the end this problem: The register \0 didn't hold the path of the search-result. Because of this the shell command only worked in a specific directory. Also, it seemed that Gtk-find didn't manage all shell functions.

Here is my soultion:

Code: Select all

rm -f /root/temp/* && find /mnt/hda4/ -depth -type f -mtime -7 -name '*' -exec ln -s {} /root/temp \;
This code
- delete content of my search directory /root/temp/
- Search for files (in example after all files modified last 7 days)
- make a symbolic link in my search directory

--> The search result can now be used by other programs.
- mp3 to Xmms for playlist
- Pictures to gtksee for slideshow
- Recent files to Graveman for backup
- And so on...

From This moment I delete my other linux distro.

Puppy GO

User avatar
MU
Posts: 13649
Joined: Wed 24 Aug 2005, 16:52
Location: Karlsruhe, Germany
Contact:

#10 Post by MU »

fine :)
I think, you might encounter 1 problem.
Lets say you have
/root/test.txt
/usr/test.txt

Then your solution would create only one symlink in /root/temp , as both have the same name.
/root/temp/test.txt

Am I right? (did not try yet).

That is the reason, why puppysearch uses such "long" symlinks containing the full path (where "/" is replaced with another character, as it may not be part of a filename).

So Puppysearch would create these symlinks:
/root/temp/root-test.txt
/root/temp/usr-test.txt

Mark

User avatar
zigbert
Posts: 6621
Joined: Wed 29 Mar 2006, 18:13
Location: Valåmoen, Norway
Contact:

#11 Post by zigbert »

I think, you might encounter 1 problem.
Lets say you have
/root/test.txt
/usr/test.txt

Then your solution would create only one symlink in /root/temp , as both have the same name.
/root/temp/test.txt

Am I right? (did not try yet).

you are absolutely right!!

This problem have occured with every "file-search-engine" I have tried...Well, that's not correct, because I have tried Puppysearch and I didn't know... :lol:. But it occures in Nautilus, Konquerer, windows explorer - win 98, Gtk-find and in the find shellcommand.

Though the problem isn't too big, because of errors that tells which files it applies to. But a really good file seacher shouldn't have that issue ?? MU. This is not any kind of pressure, but yeah, I guess you're right. - Puppysearch have potential. :D

User avatar
MU
Posts: 13649
Joined: Wed 24 Aug 2005, 16:52
Location: Karlsruhe, Germany
Contact:

#12 Post by MU »


Post Reply