Example of the `find . -type f ! -path $0` approach. Note how the script only reports the `foo.sh` within the **"d"** directory. Not the `foo.sh` in the current directory.
$ find . -print
.
./a
./b
./c
./foo.sh
./d
./d/foo.sh
$ cat foo.sh
#!/bin/bash
for f in $(find . -type f ! -path $0); do
echo $f
done
$ ./foo.sh
./a
./b
./c
./d/foo.sh
$
Alternatively, try `for f in $(find . -type f | grep -v "^\./foo\.sh$"); do`