This would be a safer way:
find /my/path/ -mindepth 2 -maxdepth 2 -type f -name 'README.txt' -mtime +30 -printf '%h\n' | xargs echo rm -r
Remove echo
if you find it already correct after seeing the output.
With that you use printf '%h\n'
to get the directory of the file, then use xargs
to process it.