if (dir.exists()) { File[] files = dir.listFiles(); for (int i = 0; i < files.length; i++) { if (!files[i].delete()) { throw new IOException("could not delete " + files[i]); } } dir.delete(); }
rmDir(new File(dir));