Java Folder Delete clearFolder(File[] children)

Here you can find the source of clearFolder(File[] children)

Description

clear Folder

License

Open Source License

Declaration

public static void clearFolder(File[] children) 

Method Source Code

//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();
        }
    }
}

Related

  1. clearDir(File dir)
  2. clearDir(File dir)
  3. clearFiles(File dir)
  4. clearFilesOnPath(String path)
  5. clearFolder(File f)
  6. clearFolder(String directoryLocation)
  7. clearFolder(String folder)
  8. clearFolder(String path)
  9. clearFolderContent(String folderName)