// Open a log file and a summary file var myLog = new File("/data/logs/today.dat"); var mySummary = new File("/data/logs/summary.dat"); // Open the log file for reading and the summary file for // appending. myLog.open("br"); mySummary.open("ba"); // Append the contents of the log file to the summary file for(var i = 0; i <= myLog.getLength(); i++){ myLog.setPosition(i); myByte = myLog.readByte(1); mySummary.writeByte(myByte); } // Flush the buffer to the file mySummary.flush(); // Close the files myLog.close(); mySummary.close();