|
|
Find and replace whole files
|
|
|
|
Senior User
Join Date: Oct 1999
Location: Planet Earth
Status:
Offline
|
|
Is there any programs out there that will allow me to find and replace entire files?
|
---I'm on a low Microsoft diet.
|
|
|
|
|
|
|
|
Addicted to MacNN
Join Date: Jun 1999
Location: Las Vegas, NV, USA
Status:
Offline
|
|
|
|
|
|
|
|
|
|
|
Mac Elite
Join Date: May 2001
Status:
Offline
|
|
Find and replace files or their contents or text in their contents?
-
|
|
|
|
|
|
|
|
|
Senior User
Join Date: Oct 1999
Location: Planet Earth
Status:
Offline
|
|
I have a bunch of index.html files located throughout various directories (hundreds). So I want to search through all the directories and replace those index.html files with new index.html files (redirect pages).
So I need to find the files, and replace them with new files.
|
---I'm on a low Microsoft diet.
|
|
|
|
|
|
|
|
Addicted to MacNN
Join Date: Jun 1999
Location: Las Vegas, NV, USA
Status:
Offline
|
|
The Finder will find these for you. Replacing them will be more difficult. As you rebuild these files it might be a lot easier to have one index.html file and make all the others aliases of that original. Then in the future you will just edit one file and the rest will automatically take care of themselves.
Chris
|
|
|
|
|
|
|
|
|
Mac Elite
Join Date: May 2001
Status:
Offline
|
|
You can use the find command in the terminal:
Code:
find /path/to/webserver-root -name "index.html" -exec cp /path/to/new/index.html {} \;
Have a look at man find first so you know what you're doing. And do a backup first.
-
|
|
|
|
|
|
|
|
|
Dedicated MacNNer
Join Date: Nov 2000
Location: Glasgow
Status:
Offline
|
|
You can also use BBEdit's multi-file search and replace, with a filename filter in place, such that it will only match index.html files.
|
PowerBook G4 17"
Power Mac G4/800, 1Gb RAM, 80Gb HDD, Superdrive, GeForce 4MX, Gateway 21" CRT, Apple Pro Speakers, iSub - Running Mac OS X Server 10.2
iBook 500, 192MbRAM - Running Mac OS X 10.2
iPod 5Gb
|
|
|
|
|
|
|
|
Mac Elite
Join Date: Feb 2001
Location: Washington, DC
Status:
Offline
|
|
Originally posted by Moonray:
You can use the find command in the terminal:
Code:
find /path/to/webserver-root -name "index.html" -exec cp /path/to/new/index.html {} \;
Have a look at man find first so you know what you're doing. And do a backup first.
-
I was going to recommend a shell script, but since you're only doing this once, that'll work nicely for what you want.
And, yes.. do back up, just in case.
|
/Earth\ Mk\.\ I{2}/
|
|
|
|
|
|
|
|
Senior User
Join Date: Oct 1999
Location: Planet Earth
Status:
Offline
|
|
Originally posted by Moonray:
You can use the find command in the terminal:
Code:
find /path/to/webserver-root -name "index.html" -exec cp /path/to/new/index.html {} \;
Have a look at man find first so you know what you're doing. And do a backup first.
-
The power of Unix at work! This worked perfectly.
|
---I'm on a low Microsoft diet.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Forum Rules
|
|
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
|
|
|
|
|
|