pathikrit/better-files

FileNotFoundExceptions when calling 'size' on a directory

aumann opened this issue · 1 comments

The version in use was 3.6.0 but the commit history does not show relevant changes since then.

When calculating the size of a directory, and a file inside this directory gets renamed while this calculation is in progress, FileNotFoundException s are thrown.

The call to size boils down to walk()(visitOptions).map(f => Files.size(f.path)).sum.

Maybe a solution is to add an option for ignoring IOExceptions to the 'size' method.

Yes, Java IO is not supposed to work in a concurrent environment. Will add flag as you mentioned.