Java tutorial
//package com.java2s; import java.io.File; public class Main { public static long getFolderSize(File file) { long size = 0; File[] fileList = file.listFiles(); for (int i = 0; i < fileList.length; i++) { if (fileList[i].isDirectory()) { size = size + getFolderSize(fileList[i]); } else { size = size + fileList[i].length(); } } return size; } }