There is a local copy of the site (or rather, html-book), which was written by a very "talented" person.

I experimented with file names both on disk and in html files. Well, the fact that the names sometimes do not coincide, there is nothing wrong with that, IE opened everything calmly and beautifully.

And now I need to run all this under lighttpd , which is able to distinguish between the case of characters.

Actually the question: how to fix this mess?

That is, how to bring all the names of files and directories in lower case. Or in html-files at least.

Links have the form

<td><img src="menu_im/MenuBot.gif" width="168"> 
  • 2
    Please provide a typical example of a link to a file (completely the whole <a ...> tag). better - right in the question by clicking edit . - aleksandr barakin

1 answer 1

I proceed from the fact that:

  • backup there
  • the current directory is the “root” of the “document”
  • The links are in the form: href="ссылка" and src="ссылка"
  • no external links

in question two sub-questions:

  1. rename files and directories . This can be done using a combination of the find and prename :

     $ find -depth | prename 's,([^/]+)$,\L$1,' 
  2. fix file contents . This can be done with a combination of the find , xargs and sed programs:

     $ find -type f -iname \*.html | xargs sed -ri 's/ (src|href)="([^"]+)"/ \1="\L\2"/'