If I understand correctly you want to remove all the
foo.exe under a certain directory (/home/pkd/foll) if the
directory above has the same name (minus the extension).
In which case, the following script would do the job
(adjust the variable TOP to your actual top directory).
If some of your directories or files have spaces or
spurrious characters use double quotes ("$f" instead of $f).
Code:
#!/bin/sh
TOP=/home/pkd/foll
find $TOP/* | while read f
do
if [ -d $f ]; then
name=${$f##*/}
if [ -e $f/$name.exe ]; then
rm -f $f/$name.exe
fi
fi
done
this script recurses thru the entire tree under the
top directory and every time it finds a directory it
checks the presence of a file that has the same name
as the base directory and an 'exe' extension. If it finds
any it removes it.