long total = 0L;
for(File f : files)
{
//how to add?
}
Here is my code. I wanna to get the size of directorys inside a directory. Does anyone have idea about how to do that?
long total = 0L;
for(File f : files)
{
//how to add?
}
Here is my code. I wanna to get the size of directorys inside a directory. Does anyone have idea about how to do that?
You can get the size of directory by using common.io package:
long size = sizeOfDirectory(File directory);
Counts the size of a directory recursively (sum of the length of all files).