Title should read: 'search-for-files: Graphical search for any Desktop Environment and File Manager (GTK required)'
This script can be run from the command line, a custom application launcher, or whatever you like.
Later I will show how to run it from Thunar, as a custom action (so you can easily right-click and search multiple directories). Personally, I have Gnome, but I prefer to use this & thunar instead of the gnome search tool & nautilus.
new version! 0.25
Features added:
options as script arguments
native language support (when translation file is in same directory)
more compatible: can limit the number of results displayed
more usable: can redraw search results (-r). note: this could be slow depending on your hardware and the number of results
more flexible: can open parent folder instead of file (-p)
more searchable: can search multiple paths
more sortable: now can sort by date
more legible: human-readable filesize
also! supports regular expressions! (except for /$ and ^/ ..)
and also allows searching of root-owned directories (well, at least on my system)
Usage: search-for-files -pr -g
WxH -l
N -f
filemanager [path1] [...] [pathN]
A note on translation:
A brazilian portugese locale file ( UTF-8 ) is included with the script (thanks, LKRaider!!).
If you are using this as your language then it will translate automatically. Otherwise, if you want to make your own one, it should follow the same naming convention and be in the same directory as the script. `echo $LANG` to find your locale language and encoding.
How to set it up
click here and save the file to your home directory (~). (the file is also attached at the end of this post)
Now copy and paste the following code into the Terminal to uncompress it, store it and make it executable.
Code:
if ! [ -e ~/.bash-scripts ] ; then mkdir ~/.bash-scripts ; fi
tar xvjf ~/search-for-files-v0.25.tar.bz2 -C ~/.bash-scripts/
chmod a+x ~/.bash-scripts/search-for-files*
then we need to install zenity, which draws the dialogs:
Code:
sudo apt-get install zenity
Now it is ready to be used. A quick test would be to open a terminal or Alt-F2, then enter `bash ~/.bash-scripts/search-for-files -r -l 100 -f thunar` or `bash ~/.bash-scripts/search-for-files -pr -l 500 -f nautilus ~/`
Thunar integration
Thunar > Edit > Configure Custom actions
Click the appropriate button at the right of the window to add a custom action
In tab 'Basic'..
Name:
Search for Files
Description:
Search this folder for files
Command:
bash ~/.bash-scripts/search-for-files -r -l 250 -f thunar %F
Icon:
/usr/share/icons/Tango/scalable/actions/search.svg
You may want to change the command yourself. Here, the window is set to redraw and displayed results are limited to (a memory-friendly) 250.
In tab 'Appearance Conditions'..
File Pattern:
*
Appears if selection contains:
Directories
You'll need to open a new Thunar window for the custom action to show up.
Now all you need to do is (1) select the directory(ies) you want to search, (2) enter the search string and let it run. (3) Double-clicking an item or selecting one and hitting 'OK' will (4) open up that item or its parent directory.
another shot of how it is supposed to work:
Bookmarks