Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Find and Replace on 1200+ HTML files

New Here ,
Sep 16, 2022 Sep 16, 2022

I have a simple website that I need to change.  It has about 1200 or more HTML files.  For some reason internal links to other HTML files within the site (via a href) have an error.  I need to do a mass modification.

The html links are suppose to be /book_0001.html, /book_0002.html, etc, but for some reason are /book/0001.html, /book/0002.html, etc. Needless to say, the links do not work.  I want to change these back to but do not want to open every file, find every link and change it manually.  I have somewhat of a life 🙂  I have searched and tried the wildcards on some of the other post like ([^<]*) & [^"]* but either I am doing it wrong or just will not work.  Any help?

TOPICS
Code , Error
558
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Sep 16, 2022 Sep 16, 2022

Are there any links that need to stay /book/ ?

If not there shouldn't be any need for RegEx modifiers....

1. Make a backup of your site.
2. Hit Ctrl + Shift +F (or Find > Find and Replace in Files)
3. In the Basic tab, place /book/ in the Find field
4. Leave the In field as Entire Current Local Site and [any tag]
5. In the Replace field, add /book_
6. Hit Replace All

Translate
Community Expert ,
Sep 16, 2022 Sep 16, 2022

Are there any links that need to stay /book/ ?

If not there shouldn't be any need for RegEx modifiers....

1. Make a backup of your site.
2. Hit Ctrl + Shift +F (or Find > Find and Replace in Files)
3. In the Basic tab, place /book/ in the Find field
4. Leave the In field as Entire Current Local Site and [any tag]
5. In the Replace field, add /book_
6. Hit Replace All

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Sep 16, 2022 Sep 16, 2022

I can do this only partially.  The word "book" was just a filler.  It is actually 66 different book names. So I can work it off that end but was looking for a way to fix it on the number side. Thanks, I'll try this.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 16, 2022 Sep 16, 2022

Before you go down this long  rabbit hole, do the links work on the actual server?   If it 'ain't broke, don't fix it.

 

Root root relative link paths typically work just fine on actual servers but fail when tested locally.    Some people actually prefer them.

 

If you use a local testing server, you can configure it to handle root relative links if you absolutely need to.

 

As to your bigger problem, nobody should be managing a 1200 page static website.  It's time to move to server-side tecchnologies with a database-driven site.  Among other things, changing sitewide links would require only a line or two of code.  Something to think about...

 

 

Nancy O'Shea— Product User, Community Expert & Moderator
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Sep 16, 2022 Sep 16, 2022

This is simple text pages and rather old.  I did test both local and on the server. I had to fix a bad link on all the sheets and did a find and replace on all the files.  Once I got this complete I found this error but it is not as simple as replacing www.websiteOLD.com with www.websiteNEW.com.  Now it's more complicated and looking for a simpler way.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 16, 2022 Sep 16, 2022

How many links are you talking about?

How did the link paths get so messed up?

 

 

 

Nancy O'Shea— Product User, Community Expert & Moderator
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Sep 16, 2022 Sep 16, 2022

There are probably close to 150,000 missed up links. The links had a bad URL associated to it but I changed that and in doing so discovered the problem, so I guess it had always been there ever since I got the files. Thanks to Jon Fritz II comments, I am working on changing to book names instead of worrying about the wildcard. Thanks

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 16, 2022 Sep 16, 2022

Is it possible to supply the URL to the site so that we can see waht is going on?

Wappler is the DMXzone-made Dreamweaver replacement and includes the best of their powerful extensions, as well as much more!
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Sep 16, 2022 Sep 16, 2022

I am working on the fix.  The site is johnpwiles.com/johngill and when its fixed locally I'll upload and overwrite the current site.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 16, 2022 Sep 16, 2022

Oh, my goodness! John, I just read through Psalm 23 to get an idea of what you are doing. Great work, but extremely tedious.

 

Just a few comments about using frame sets (not to discourage you).

  • Not SEO friendly
  • Hard for screen readers to follow
  • Cannot be used for mobile devices

 

I look forward to seeing the final version.

 

 

Wappler is the DMXzone-made Dreamweaver replacement and includes the best of their powerful extensions, as well as much more!
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Sep 17, 2022 Sep 17, 2022

Thanks for the accolades.  I did get it updated and all links should now work.  I know it's a very old site that I obtained after before the site shutdown.  Not really concerned with search engines, mostly just for personal reference and passing on to interested people, word of mouth.  I will keep a copy and play around some to see what Dreamweaver can do for it.  I'm not much of a webdesigner, I started with Microsoft Frontpage years ago, and basically edit in notepad.  You are welcome to save and share the site. Thanks again.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 17, 2022 Sep 17, 2022

sometimes I need to have a concrete example to better understand what to do next...
could you , please, give me two different examples of bad URLs, and their respective desired corrections ?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Sep 17, 2022 Sep 17, 2022
LATEST

It's solved now, thanks.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines