Java Delete File Recursively deleteRecursive(File file)

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

Description

Think "deltree" or "rm -r".

License

Apache License

Parameter

Parameter Description
file directory to remove recursively TODO: duplicate with org.pathvisio.util.FileUtils

Declaration

public static void deleteRecursive(File file) 

Method Source Code


//package com.java2s;
// Licensed under the Apache License, Version 2.0 (the "License");

import java.io.File;

public class Main {
    /**//w  w  w . j av  a 2  s.  co  m
     * Think "deltree" or "rm -r".
     * @param file directory to remove recursively
     * TODO: duplicate with org.pathvisio.util.FileUtils
     */
    public static void deleteRecursive(File file) {
        if (file.isDirectory()) {
            for (File f : file.listFiles())
                deleteRecursive(f);
        }
        file.delete();
    }
}

Related

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