I have to following code that does return 0 for every file. I am wondering what is the correct way of get the file size with Files/Path.
import java.nio.file.Files;
import java.nio.file.Path;
Stream<Path> files = Files.list(new File("/tmp").toPath());
files.filter(p -> p.getFileName().toString().endsWith(".test"))
.filter(p -> p.getFileName().toFile().length() > 0)
.filter(p -> Files.isRegularFile(p))
.forEach(filePath -> {
Log.info("Size of file KB :: " +
String.valueOf(
filePath.getFileName().toFile().length() / 1024));
});