Java Folder Size Get folderSize(File directory)

Here you can find the source of folderSize(File directory)

Description

folder Size

License

Apache License

Declaration

public static long folderSize(File directory) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.io.File;

public class Main {
    public static long folderSize(File directory) {
        long length = 0;
        for (File file : directory.listFiles()) {
            if (file.isFile()) {
                length += file.length();
            } else {
                length += folderSize(file);
            }//from  w  w  w  .j av a2s .  c o  m
        }
        return length;
    }
}

Related

  1. emSize(Font font, double em)
  2. folderSize(File directory)
  3. folderSize(File directory)
  4. fontSize(Font f)
  5. fontSize(Font f)