Android Folder Size Get getFolderSize(File file)

Here you can find the source of getFolderSize(File file)

Description

get Folder Size

Declaration

public static long getFolderSize(File file) 

Method Source Code

//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();
            }// w w w .  ja v a 2s  .  c  o  m
        }
        return size;
    }
}

Related

  1. getSize(final File path)
  2. getFolderSize(java.io.File file)