Java tutorial
//package com.java2s; import java.io.File; public class Main { private static long getDirSize(File dir) { long size = 0; File[] files = dir.listFiles(); for (File file : files) { if (file.isFile()) { size += file.length(); } } return size; } }