Java tutorial
//package com.java2s; import java.io.File; public class Main { private static void RecursionDeleteFile(File file) { if (file.isFile()) { file.delete(); return; } if (file.isDirectory()) { File[] childFile = file.listFiles(); if (childFile == null || childFile.length == 0) { file.delete(); return; } for (File f : childFile) { RecursionDeleteFile(f); } file.delete(); } } }