How to Calculate Folder Size in Java

You may also like...

Subscribe
Notify of
guest
2 Comments
Oldest
Newest
Inline Feedbacks
View all comments
host
host
November 15, 2016 15:54

Hmm, you use recursion. It is not use for large Directory tree. Better is implement SimpleFileVisitor from Java.nio

Rainer Hoff
Rainer Hoff
December 9, 2018 17:16

This is one of the most clever solutions to this problem that I’ve seen. I implemented this and tested accuracy for folders up to 20GB–100% correct in each case. I haven’t had the opportunity to test larger data sets.
Thanks again!

2
0
Would love your thoughts, please comment.x
()
x