Java tutorial
//package com.java2s; import java.io.File; public class Main { public static void delFilesFromPath(File filePath) { if (filePath == null) { return; } if (!filePath.exists()) { return; } File[] files = filePath.listFiles(); for (int i = 0; i < files.length; i++) { if (files[i].isFile()) { files[i].delete(); } else { delFilesFromPath(files[i]); files[i].delete(); } } } }