Re: How to search for files in Xubuntu / XFCE with just Thunar and a Bash script

Originally Posted by kalikiana

As the new version is out, I translated it to German and Spanish. I hope that somebody will like them.

Sadly the script is not ideal, in fact you might need to remove the '@euro' from the end of the filename.

Ok, I have modified the script to look for the closest equivalent language file.

If the exact locale file is not there, it will look for:
aa_AA.BBB*
aa_AA*
aa*

in that order. So if you don't have that particular variation on the language, you can use something similar that might work

an example:
if your locale is zh_TW.euctw
it will look for 'search-for-files_locale.zh_TW.euctw'
if that doesnt exist it will look for anything beginning with 'search-for-files_locale.zh_TW'
if that doesnt exist it will look for anything beginning with 'search-for-files_locale.zh' (and will match zh_CN.gbk, which may be similar enough to use)
(and of course if that doesnt exist it falls back to english)

this is because some languages, like chinese, have many different locales

Re: How to search for files in Xubuntu / XFCE with just Thunar and a Bash script

Originally Posted by SimonJones

I am having permission problems, I write perl scripts for web sites, some are executable.

When I click on them in the search the pane they execute rather than allow editing, how can I change this?

The command filemanager filename is being executed, so you can either change how your filemanager deals with these files; or you can use search-for-files -p to cause the script to open the parent folder instead of the file itself.

Re: How to search for files in Xubuntu / XFCE with just Thunar and a Bash script

Wow! This is really neat! Absolutely what I needed!! I use it often Thanks But for the installation, if you want something easier, you can check my Thunar script: http://ubuntuforums.org/showthread.php?t=380602 I've done a little install.sh that allows us to add entry to the User Custom Actions, it isn't really hard.

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 argumentsnative 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)

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.

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.

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.

one problem....after i run a search and get multiple results, can i select multiple files from that list and drag them to another window? in my case i've stored all the fonts i collected in windows in multiple directories based on its name. so i did a search for *.ttf with this search script. works BEAUTIFULLY but i cant select all the fonts and drag them to my ~/.fonts folder. got any ideas? thanks!