Submitted by whirlpool on Wed, 15/12/2004 - 13:42.
( categories: )

Several months ago I wrote this ugly bash script to supplement my favourite file manager, ROX.

This script pops up a text entry box, using zenity for your search term. It will then use find to find the files in your home directory, /home/pub, and cdrom. It then creates a temporary folder with symlinks to the matching files, and opens it with ROX.

#!/bin/bash

autosymlinks () 
{
        dir_path=`mktemp -d ~/tmp/gxsearch.XXXXXXX`
        find ~/ /home/pub/ /mnt/cdrom -iname "$1" -exec ln -s "{}" $dir_path \; 
        echo $dir_path
}

search_string=`zenity --title="Find files" --entry --text="Enter file name to fi
nd"` &&
{
temp_dir=`autosymlinks "$search_string"` 
rox -n $temp_dir &&
rm -fvr $temp_dir
}

I would rather use locate than find, for speed. But, I don't know how.

You will have to use wild cards, if you write parts of filename in search box. Example *ruins*