homepage Welcome to WebmasterWorld Guest from 23.20.196.179
register, login, search, subscribe, help, library, PubCon, announcements, recent posts, open posts,
Subscribe to WebmasterWorld
Visit PubCon.com
Home / Forums Index / Hardware and OS Related Technologies / Linux, Unix, and *nix like Operating Systems
Forum Library : Charter : Moderators: bakedjake

Linux, Unix, and *nix like Operating Systems Forum

    
Find and replace many files at once
gutabo




msg:4463542
 9:57 am on Jun 10, 2012 (gmt 0)

Greetings,

Due to a server error we lost the content of 10 of our sites, many of them very, very old. We have been compressing our backups and uploading them the last couple of days. Now that the server is ready, we face a problem: many of the .html, .php and .shtml files have absolute paths that have changed a lot. We have tried to change them like this:

find backupPath -type f | xargs perl -pi -e 's/obscenelyLongOldPath/\/newPath\/public_html\//g'

Thing is, it seems to run for a couple of files and then stops. It doesn't even affect subdirectories. Do you guys know a way to make this? Thanks in advance!

 

gutabo




msg:4463699
 9:19 pm on Jun 10, 2012 (gmt 0)

Nevermind, found a way:

cd rootPath
find . -type f -print0 | xargs -0 sed -i 's/obscenelyLongOldPath/newPath/g'

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Hardware and OS Related Technologies / Linux, Unix, and *nix like Operating Systems
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About
WebmasterWorld ® and PubCon ® are a Registered Trademarks of Pubcon Inc.
© Pubcon Inc. 1996-2012 all rights reserved