-
Notifications
You must be signed in to change notification settings - Fork 982
/
FolderFileCounter.java
51 lines (41 loc) · 1.68 KB
/
FolderFileCounter.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
// 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 <code>true</code> on success, <code>false</code> 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
// ===========================================================
}