01: /*
02: * Created on Jan 12, 2006
03: *
04: * TODO To change the template for this generated file go to
05: * Window - Preferences - Java - Code Style - Code Templates
06: */
07: package org.enhydra.snapperAdmin.business;
08:
09: import java.io.File;
10:
11: /**
12: * @author Zoran Milakovic
13: *
14: * TODO To change the template for this generated type comment go to
15: * Window - Preferences - Java - Code Style - Code Templates
16: */
17: public class FinalDeleter {
18:
19: public static boolean deleteDir(File folder) {
20: boolean retVal = false;
21: try {
22: deleteSubDirs(folder);
23: FileDeleter.delete(folder);
24: } catch (RuntimeException e) {
25: }
26: retVal = true;
27: return retVal;
28: }
29:
30: private static void deleteSubDirs(File folder) {
31: File[] childs = folder.listFiles();
32: if (childs != null) {
33: for (int i = 0; i < childs.length; i++) {
34: File toDelete = childs[i];
35: deleteSubDirs(toDelete);
36: FileDeleter.delete(toDelete);
37: }
38: }
39: }
40:
41: }
|