find . -name "*.html" -type f -print0 | xargs -0 perl -i -pe "s/\/index.html/\//g" See https://www.lullabot.com/articles/sending-a-drupal-site-into-retirement