/* * [SplitWebsite.java] * * Summary: Prepare splitwebsite.btm to split mindprod.com in two. * * Copyright: (c) 2016-2017 Roedy Green, Canadian Mind Products, http://mindprod.com * * Licence: This software may be copied and used freely for any purpose but military. * http://mindprod.com/contact/nonmil.html * * Requires: JDK 1.8+ * * Created with: JetBrains IntelliJ IDEA IDE http://www.jetbrains.com/idea/ * * Version History: * 1.0 2016-06-01 initial version */ package com.mindprod.repair; import com.mindprod.common18.EIO; import com.mindprod.csv.CSVReader; import java.io.BufferedWriter; import java.io.EOFException; import java.io.File; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import java.io.PrintWriter; import static java.lang.System.*; /** * Prepare splitwebsite.btm to split mindprod.com in two. * * @author Roedy Green, Canadian Mind Products * @version 1.0 2016-06-01 initial version * @since 2008 */ public class SplitWebsite { private static final int FIRST_COPYRIGHT_YEAR = 2016; /** * undisplayed copyright notice */ @SuppressWarnings( { "UnusedDeclaration" } ) private static final String EMBEDDED_COPYRIGHT = "Copyright: (c) 2016-2017 Roedy Green, Canadian Mind Products, http://mindprod.com"; @SuppressWarnings( { "UnusedDeclaration" } ) private static final String RELEASE_DATE = "2016-06-01"; /** * embedded version string. */ @SuppressWarnings( { "UnusedDeclaration" } ) private static final String VERSION_STRING = "1.0"; /** * @param args name of method to look for */ public static void main( String[] args ) { try { // O P E N final CSVReader r = new CSVReader( new FileReader( new File( "E:/com/mindprod/repair/splitspec.csv" ) ) ); final FileWriter fw = new FileWriter( "E:/com/mindprod/repair/splitwebsite.btm", false /* append */ ); final BufferedWriter bw = new BufferedWriter( fw, 16_384 /* 32K bytes/16K chars, 50% of 64K byte allocation is optimal */ ); final PrintWriter prw = new PrintWriter( bw, false /* auto flush on println */ ); try { prw.println( "rem splitwebsite.btm -- freshen website split files from mindprod" ); while ( true ) { final String category = r.get(); final String dir = r.get().replace( '/', '\\' ); r.skipToNextLine(); final File ca = new File( "E:\\mindprodca", dir ); final File com = new File( "E:\\mindprodcom", dir ); final File orig = new File( "E:\\mindprod", dir ); switch ( category ) { case "ca": if ( !orig.exists() ) { err.println( "Missing " + EIO.getCanOrAbsPath( orig ) ); } if ( !ca.exists() ) { err.println( "Missing " + EIO.getCanOrAbsPath( ca ) ); } prw.println( "copy /S /UF E:\\mindprod\\" + dir + "\\ " + "E:\\mindprodca\\" + dir + "\\" ); break; case "com": if ( !orig.exists() ) { err.println( "Missing " + EIO.getCanOrAbsPath( orig ) ); } if ( !com.exists() ) { err.println( "Missing " + EIO.getCanOrAbsPath( com ) ); } prw.println( "copy /S /UF E:\\mindprod\\" + dir + "\\ " + "E:\\mindprodcom\\" + dir + "\\" ); break; case "both": if ( !orig.exists() ) { err.println( "Missing " + EIO.getCanOrAbsPath( orig ) ); } if ( !com.exists() ) { err.println( "Missing " + EIO.getCanOrAbsPath( com ) ); } if ( !ca.exists() ) { err.println( "Missing " + EIO.getCanOrAbsPath( ca ) ); } prw.println( "copy /S /UF E:\\mindprod\\" + dir + "\\ " + "E:\\mindprodca\\" + dir + "\\" ); prw.println( "copy /S /UF E:\\mindprod\\" + dir + "\\ " + "E:\\mindprodcom\\" + dir + "\\" ); break; default: throw new IllegalArgumentException( "must be ca/com/both: " + category + " " + r.lineCount() ); } } // end process each file } catch ( EOFException e ) { prw.println( "md E:\\mindprodca\\sound\\" ); prw.println( "md E:\\mindprodcom\\sound\\" ); prw.println( "md E:\\mindprodca\\sound\\song\\" ); prw.println( "copy /UF E:\\mindprod\\sound\\ E:\\mindprodca\\sound\\" ); prw.println( "copy /UF E:\\mindprod\\sound\\ E:\\mindprodcom\\sound\\" ); prw.println( "copy /UF E:\\mindprod\\sound\\song\\ E:\\mindprodca\\sound\\song\\" ); prw.println( "copy /UFS E:\\mindprod\\sound\\esperanto\\ E:\\mindprodcom\\sound\\esperanto\\" ); prw.println( "copy /UF E:\\mindprod\\*.css E:\\mindprodca\\" ); prw.println( "copy /UF E:\\mindprod\\*.css E:\\mindprodcom\\" ); prw.println( "copy /UF E:\\mindprod\\labels.rdf E:\\mindprodca\\" ); prw.println( "copy /UF E:\\mindprod\\labels.rdf E:\\mindprodcom\\" ); prw.println( "copy /UF E:\\mindprod\\product*.html E:\\mindprodcom\\" ); prw.println( "propagate.exe E:\\mindprod\\index.html E:\\mindprodca\\index.html \"\" \"\"" ); prw.println( "propagate.exe E:\\mindprod\\index.html E:\\mindprodcom\\index.html \"\" \"\"" ); prw.println( "propagate.exe E:\\mindprod\\index.html E:\\mindprodca\\index.html \"\"" ); prw.println( "propagate.exe E:\\mindprod\\index.html E:\\mindprodcom\\index.html \"\"" ); // C L O S E prw.close(); r.close(); } } catch ( IOException e ) { err.println( "problem with reading splitspec " + e.getMessage() ); } out.println( "done" ); } }