02. public static void delete(File file) {
03. if (file.isFile()) {
04. file.delete();
05. return;
06. }
07.
08. if(file.isDirectory()){
09. File[] childFiles = file.listFiles();
10. if (childFiles == null || childFiles.length == 0) {
11. file.delete();
12. return;
13. }
14.
15. for (int i = 0; i < childFiles.length; i++) {
16. delete(childFiles[i]);
17. }
18. file.delete();
19. }
20. }
03. if (file.isFile()) {
04. file.delete();
05. return;
06. }
07.
08. if(file.isDirectory()){
09. File[] childFiles = file.listFiles();
10. if (childFiles == null || childFiles.length == 0) {
11. file.delete();
12. return;
13. }
14.
15. for (int i = 0; i < childFiles.length; i++) {
16. delete(childFiles[i]);
17. }
18. file.delete();
19. }
20. }