Trying to send Gtk-find search result to ROX-filer [SOLVED]
Trying to send Gtk-find search result to ROX-filer [SOLVED]
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.
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.
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?????
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?????
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 |
Like using %25 in a URL?
So one could do something like:
sed 's/ /%25;/g' \0 |
Code: Select all
BTW - How did you manage it in Puppysearch 1.0.
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
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
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
Thanks for reply!
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.
I think this could be a sort of solution, but it is still not working.sed 's/ /%25;/g' \0 |
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.
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:
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
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 \;
- 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
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
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
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... . 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.