class Helper extends ErrorAware {

    public static long folderSize(File directory) {
        // from https://stackoverflow.com/a/2149807
        long length = 0;
        File[] content = directory.listFiles();
        if (content != null) {
            for (File file : content) {
                if (file.isFile())
                    length += file.length();
                else
                    length += folderSize(file);
            }
        }
        return length;
    }

}