Filter on file creation time instead of last modified time
@@ -7,6 +7,7 @@ import javax.xml.bind.DatatypeConverter;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
+import java.nio.file.attribute.BasicFileAttributes;
public class LogReader {
@@ -28,9 +29,7 @@ public class LogReader {
private void traverse_folder(File root, JSONObject json, String filename) throws IOException, JSONException {
File[] files = root.listFiles();
for(File child : files) {
- File temp = child;
- JSONObject childJson = new JSONObject();
- long logTime = child.lastModified();
+ long logTime = Files.readAttributes(child.toPath(), BasicFileAttributes.class).creationTime().toMillis();
if(child.isFile() && earliestLogThreshold < logTime && logTime < latestLogThreshold) {
json.put(filename + child.getName(), DatatypeConverter.printBase64Binary(Files.readAllBytes(child.toPath())));
}
