Here you can find the source of deleteDirectory(String path)
public static boolean deleteDirectory(String path)
//package com.java2s; /**//from www. j a v a2 s.c o m * Copyright (c) 2015 SK holdings Co., Ltd. All rights reserved. * This software is the confidential and proprietary information of SK holdings. * You shall not disclose such confidential information and shall use it only in * accordance with the terms of the license agreement you entered into with SK holdings. * (http://www.eclipse.org/legal/epl-v10.html) */ import java.io.File; public class Main { public static boolean deleteDirectory(String path) { boolean isOk = false; try { File dir = new File(path); if (dir.isDirectory()) { String[] children = dir.list(); for (int i = 0; i < children.length; ++i) { boolean success = deleteDirectory(new File(dir, children[i]).getAbsolutePath()); if (!(success)) { return false; } } } return dir.delete(); } catch (Exception localException) { isOk = false; } return isOk; } }