Skip to main content

NIO2- How to retrieve a file tree size without using Files.walkFileTree ?

No replies
jlover2010
Offline
Joined: 2010-01-15
Points: 0

Hi,
I want to have the size of a file tree (that is by having a directory - empty or not empty sub-directories - contains several directories and file).

So i used :

Attributes.readBasicFileAttributes(startingDirectory).size();

the "startingDirectory" is a directory of type Path, and the result is 0(zero)

Should i have to walk the file tree (i know how to use that in nio2...) or there is another better approach?

Thanks in advance.

P.S: doesn't the editor of this forum have a "code" tag ?