Do you know how can I get the folder size in Java?
The length() method in the File class only works for files, using that method I always get a size of 0.
import java.io.File; import org.apache.commons.io.FileUtils; public class FolderSize { public static void main(String[] args) { long size = FileUtils.sizeOfDirectory(new File("C:/Windows/folder")); System.out.println("Folder Size: " + size + " bytes"); } }