-
Notifications
You must be signed in to change notification settings - Fork 982
/
FolderDeleter.java
56 lines (46 loc) · 1.91 KB
/
FolderDeleter.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
52
53
54
55
56
// Created by plusminus on 2:27:27 AM - Mar 6, 2009
package org.osmdroid.mtp.util;
import java.io.File;
public class FolderDeleter {
// ===========================================================
// Constants
// ===========================================================
// ===========================================================
// Fields
// ===========================================================
// ===========================================================
// Constructors
// ===========================================================
// ===========================================================
// Getter & Setter
// ===========================================================
// ===========================================================
// Methods from SuperClass/Interfaces
// ===========================================================
// ===========================================================
// Methods
// ===========================================================
/**
* @return <code>true</code> on success, <code>false</code> otherwise.
*/
public static boolean deleteFolder(final File pFolder) {
final File[] children = pFolder.listFiles();
for (final File c : children) {
if (c.isDirectory()) {
if (!deleteFolder(c)) {
System.err.println("Could not delete " + c.getAbsolutePath());
return false;
}
} else {
if (!c.delete()) {
System.err.println("Could not delete " + c.getAbsolutePath());
return false;
}
}
}
return pFolder.delete();
}
// ===========================================================
// Inner and Anonymous Classes
// ===========================================================
}