Here you can find the source of deleteDirs(String pathname)
public static void deleteDirs(String pathname)
//package com.java2s; //License from project: Apache License import java.io.File; public class Main { public static void deleteDirs(String pathname) { if (pathname == null || pathname.isEmpty()) { return; }//from ww w .j a v a 2s .c om File path = new File(pathname); deleteDirs(path); } public static void deleteDirs(File path) { if (!path.exists()) return; if (path.isFile()) { path.delete(); return; } File[] files = path.listFiles(); for (File file : files) { deleteDirs(file); } path.delete(); } }