Thursday, January 21, 2010

Customised search in Linux using find

Below is a code to customise search in Linux using find. find would recurse through all the directories. I needed to omit some directories which I knew didn't have the file I was looking for but instead have games. So recursing through them would cause enormous processor overhead and time loss. So I wrote a code in shell script to omit specific directories..

cd /
for aa in `ls`
do

if [ "$aa" != "resident_evil" ] ; then
if [ "$aa" != "usr1" ] ; then
if [ "$aa" != "usr2" ] ; then
if [ "$aa" != "usr3" ] ; then
if [ "$aa" != "unreal" ] ; then
if [ "$aa" != "quake3" ] ; then
echo -e " Current search path: "
cd $aa
pwd
find . -name "*.a"
fi
fi
fi
fi
fi
fi


cd /

done

No comments:

OK GOOGLE on Samsung Galaxy S7 doesn’t work

To make Ok Google detection work on Galaxy S7 (Galaxy series phones) we need to perform a couple of steps. 1. As long as Samsung S vo...