Find all files with the extension .txt in the same directory as this script and execute the command 'sed -i -e 's/foo/bar/g' {}' on each of them.
find $(dirname $0) -name *.txt -exec sed -i -e 's/foo/bar/g' {} \;