I (frontend/javascript developer by trade) wholeheartedly recommend learning the standard unix tools - bash, sed, grep, awk, xargs - for these tasks. While the syntax is daunting at first, and escaping will be an eternal problem, eventually it starts making sense and you'll be able to do anything in seconds. The work in the post becomes trivial: mv app/views/foo/**/* app/views/ sed -i 's/\([a-z]*\)foo_\([a-z]*\)path/…
perl -pi -e 's{(.*?)foo_(.*?)path}{$1$2path}' app/views/*/*