All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.osmdroid.mtp.util.FolderFileCounter Maven / Gradle / Ivy

// Created by plusminus on 3:43:56 PM - Mar 6, 2009
package org.osmdroid.mtp.util;

import java.io.File;

public class FolderFileCounter {
    // ===========================================================
    // Constants
    // ===========================================================

    // ===========================================================
    // Fields
    // ===========================================================

    // ===========================================================
    // Constructors
    // ===========================================================

    // ===========================================================
    // Getter & Setter
    // ===========================================================

    // ===========================================================
    // Methods from SuperClass/Interfaces
    // ===========================================================

    // ===========================================================
    // Methods
    // ===========================================================

    /**
     * @return true on success, false otherwise.
     */
    public static int getTotalRecursiveFileCount(final File pFolder) {
        final File[] children = pFolder.listFiles();

        int tmpCnt = 0;
        for (final File c : children) {
            if (c.isDirectory()) {
                tmpCnt += getTotalRecursiveFileCount(c);
            } else {
                tmpCnt++;
            }
        }
        return tmpCnt;
    }

    // ===========================================================
    // Inner and Anonymous Classes
    // ===========================================================
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy