Java tutorial
//package com.java2s; //License from project: Open Source License import java.io.File; public class Main { public static long getFolderSize(File f) { long size = 0; if (f.isDirectory()) { for (File file : f.listFiles()) { size += getFolderSize(file); } } else { size = f.length(); } return size; } }