[sourcecode]
find /path/ -name ‘*.txt’ -print | xargs sed -i ‘s/find\/replace/g’
[/sourcecode]
For example I recently needed to change the paths on 100’s of files across multiple sites on a plesk server where the imported sites had come from an ancient ensim install. It did over 1,000 replaces.
I have replaced the domain name with example.com to protect the identity of the site in question. The php code should not have had the path embedded in the code and certainly not multiple times.
[sourcecode]find /var/www/vhosts/*/httpdocs/ -name ‘*.php’ -print | xargs sed -i ‘s/\/home\/virtual\/example.com\/var\/www\/html/\/var\/www\/vhosts\/example.com\/httpdocs/g'[/sourcecode]
Leave a Reply