Java tutorial
//package com.java2s; import java.io.File; public class Main { public static void deleteRecursive(File paramFile) { if ((paramFile != null) && (paramFile.exists())) { if (paramFile.isDirectory()) { File[] arrayOfFile = paramFile.listFiles(); int j = arrayOfFile.length; int i = 0; while (i < j) { deleteRecursive(arrayOfFile[i]); i += 1; } } paramFile.delete(); } } }