-3
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?

Jeremy
  • 5
  • 1

1 Answers1

0

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).

Salah
  • 8,567
  • 3
  • 26
  • 43