Java Delete File Recursively deleteRecursive(File f)

Here you can find the source of deleteRecursive(File f)

Description

Delete directory or file recursively

License

BSD License

Declaration

public static void deleteRecursive(File f) throws IOException 

Method Source Code

//package com.java2s;
/***// w w  w  .  j ava  2s.  c om
 * Copyright (C) 2010 Johan Henriksson
 * This code is under the Endrov / BSD license. See www.endrov.net
 * for the full text and how to cite.
 */

import java.io.File;

import java.io.IOException;

public class Main {
    /**
     * Delete directory or file recursively
     */
    public static void deleteRecursive(File f) throws IOException {
        if (f.isDirectory())
            for (File c : f.listFiles())
                deleteRecursive(c);
        f.delete();
    }
}

Related

  1. deleteRecursive(File dir)
  2. deleteRecursive(File dir)
  3. deleteRecursive(File f)
  4. deleteRecursive(File f)
  5. deleteRecursive(File f)
  6. deleteRecursive(File file)
  7. deleteRecursive(File file)
  8. deleteRecursive(File file)
  9. deleteRecursive(File file)