Here you can find the source of clearFolder(File[] children)
public static void clearFolder(File[] children)
//package com.java2s; /******************************************************************************* * Copyright (c) 2007 Red Hat, Inc.//from w w w . java 2s . c o m * Distributed under license by Red Hat, Inc. All rights reserved. * This program is made available under the terms of the * Eclipse Public License v1.0 which accompanies this distribution, * and is available at http://www.eclipse.org/legal/epl-v10.html * * Contributors: * Red Hat, Inc. - initial API and implementation ******************************************************************************/ import java.io.File; public class Main { public static void clearFolder(File[] children) { for (int i = 0; i < children.length; i++) { File[] second = children[i].listFiles(); if (second != null && second.length > 0) clearFolder(second); children[i].delete(); } } }