/******************************************************************************* Programmer: Josh Beitelspacher Date: 17 February 2002 Program Description: This program converts a directory of SHTML files using server side includes into pure HTML files. Input Description: This program takes any two command line arguments. The first is the directory to be processed and the second the directory to place the new files in. Output Description: The output is a new directory exactly like the previous one, but with SHTML files instead of HTML files. *******************************************************************************/ import java.io.*; public class SHTMLtoHTML { public static void main(String[] args) throws IOException { FileCollection fc = new FileCollection(new File(args[0])); fc.copy(new File(args[1])); fc.filter(".shtm"); for (int i = 0; i < fc.size(); i++) { SHTMLReader shtmlReader = new SHTMLReader(fc.get(i)); String file = fc.get(i).getPath(); int index = file.indexOf(".shtm"); file = file.substring(0, index) + ".htm" + file.substring(index + 5, file.length()); HTMLWriter htmlWriter = new HTMLWriter(new File(file)); String line = shtmlReader.readLine(); while (line != null) { htmlWriter.writeLine(line); line = shtmlReader.readLine(); } shtmlReader.close(); htmlWriter.close(); } fc.deleteAll(); } }