find . -iname "*.html" -print0 | xargs -0 -n 1 perl -pi.bak -e "s/\/images\//\/other_images\//ig" #or revised following comments below (for which thanks): find . -iname "*.html" -print0 | xargs -0 perl -pi.bak -e "s/\/images\//\/other_images\//ig"