Java tutorial
//package com.java2s; //License from project: Apache License import java.io.File; public class Main { private static void clearDir(String projectDir) { File file = new File(projectDir); File[] files = file.listFiles(); if (files == null || files.length == 0) { return; } for (File f : files) { if (f.isDirectory()) { clearDir(f.getAbsolutePath()); } else { f.delete(); } } } }