-1

I am trying to change the directory structure of a website.

Is there a way to update the relative links in individual html pages when I change the directory structure?

Dreamweaver hangs, because of hundreds of HTML files and nested links.

Linktek is expensive.

Any other options?

Noor M
  • 113
  • 2
  • 5

1 Answers1

1

If all of your links are in html (not css/js/etc), then you could do this with a sed (on *nix), or with a scripting library (e.g. BeautifulSoup in python). If not, that is a complicated (potentially virtually impossible) operation, depending on how links are constructed, which I'm sure is why that product can charge what it does.

Example sed:

find directory -type f -print0 | xargs -0 sed -i -re 's:href="someoldpath/:href="somenewpath/:g'

But that's a pretty dangerous way to do it if things are not very nicely/simply laid out. Then again, if the old directory is a truly unique name, you could just find/replace that (again, unlikely).

Matthew
  • 151
  • 1
  • 3