Java tutorial
//package com.java2s; import java.io.File; public class Main { public static void deleteEveryFile(File file) { if (file.exists()) { if (file.isFile()) { file.delete(); } else if (file.isDirectory()) { File afile[] = file.listFiles(); if (afile != null) { for (int i = 0; i < afile.length; i++) deleteEveryFile(afile[i]); file.delete(); } else { file.delete(); } } } } public static void deleteEveryFile(String s) { deleteEveryFile(new File(s)); } }