Notes on how to upload large HTML directories onto TWiki

This problem came about when I used MATLAB and Photoshop to create a web page with a large number of images which I was loathe to upload to TWiki one by one.

  • Make a TWiki page which will act as the root html file. Example: RRLegCompliance
  • In a text editor, open up the HTML code and do global replaces on the HTML links. Linked files will go into
%ATTACHURL%/
so prepend this in all of the internal links. Example:
<A href="%ATTACHURL%/pages/xx.html"><IMG src="%ATTACHURL%/thumbnails/xx.jpg" border="0" alt="xx"></A>
  • Copy and paste the modified HTML code into the TWiki editor page.
  • For HTML pages that are linked from the main page, modify each so that the links point to the right place.
    I used a BASH script and SED script to do this:
    BASH Script:
       #!/bin/bash
    
       for file in *.html
         do
          sed -f fixhtml.sed $file > .temp.html
          mv .temp.html $file
       done
    
       rm -f .temp.html
    
    SED Script (fixhtml.sed):
       s:background="../images/background.jpg"::g
       s:../index.html:../../../../bin/view/Main/RRLegCompliance:g
The SED script deletes the background image from each page and replaces the link to the root page with a link to the TWiki page.
  • Use SFTP to upload the subdirectories onto BDML in the directory /home/httpd/twiki/pub/Main/PageName where PageName is the TWiki name of the page.
  • Test out the links and fix anything you forgot to change...

-- JonathanKarpick - 21 Oct 2004

 
This site is powered by the TWiki collaboration platformCopyright &© by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback