homepage Welcome to WebmasterWorld Guest from 54.198.140.182
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
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.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved