}
}
} else if (dir.exists()) {
- if (filter.contains(dir.getAbsolutePath())) {
+ if (!filter.contains(dir.getAbsolutePath())) {
if (!dir.delete()) {
throw new IOException("Could not delete file: " + dir.getAbsolutePath());
}
return FileVisitResult.CONTINUE;
}
}
+
+ public static void syncFile(File file) throws IOException {
+ try (RandomAccessFile raf = new RandomAccessFile(file, "rw")) {
+ raf.getFD().sync();
+ }
+ }
}