HOME        PACKAGES        SCRIPTS

findpng: Find A Specific "Sketches of Q" png File

Ever get frustrated when you do not know the real filename of a file created by a qtopia application? I have written a script to find the actual filename for files created by the sketch program I use, Sketches of Q, also available here (German?) and or, in English, try sketches_1_0_arm.ipk.

The script works, as is, for files created by "Sketches of Q" that are in internal memory on ROM 2.38. To use the script, if you have put the script in /home/root/findpng, simply enter:

./findpng keyword

and it will locate all "sketches of q" files with your keyword in the descriptive name.

For a keyword entry containing special characters or spaces, you can try entering the pattern by using either single or double quotes:

./findpng "word1 word2"

It will not handle regexes, from the little testing I have done. You must enter a precise keyword pattern, unless you do more tweaking than I have done.

Do not forget to make the file executable before the first time you use it:

chmod 700 findpng

If you get tired of typing the "./" before the command name, then move it somewhere like /home/QtPalmtop/bin, and you will not have to enter the "./".

mv findpng /home/QtPalmtop/bin/findpng

And here is the script:

#!/bin/bash
#
# findpng

# Usage: findpng [keyword pattern]

echo Searching for "$1" in /home/root/Documents/image/png-sketch

grep -l "$1" /home/root/Documents/image/png-sketch/*.desktop | xargs grep ^File | more

exit

Here is some sample output:

bash-2.05# ./findpng penguin
Searching for penguin in /home/root/Documents/image/png-sketch
File = /home/root/Documents/image/png-sketch/__47sketch.png
bash-2.05#

If you want to tweak the script to find files created by other Qtopia-based applications, you will either need to use recursive grep, or know the precise directory the associated desktop entry file is in.

I have only checked the syntax of desktop entry files for Sharp ROMs 2.38 and 1.12. If you have a different ROM, please let me know whether this works for you so that I can post that information here.

Thanks,
sdjf

Revised October 7, 2011