public static boolean deleteDir(File dir) {
        if (dir.isDirectory()) {
            File[] children = dir.listFiles();
            for (File child : children) {
                boolean success = deleteDir(child);
                if (!success) {
                    return false;
                }
            }
        }
        return dir.delete();
    }
public static boolean deleteDir ( File dir ) { if ( dir . isDirectory ( ) ) { File [ ] children = dir . listFiles ( ) ; for ( File child : children ) { boolean success = deleteDir ( child ) ; if ( ! success ) { return false ; } } } return dir . delete ( ) ; }
删除目录
@param dir 目录
@return 是否成功