Java File Delete delete(File f)

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

Description

delete

License

Apache License

Declaration

public static final void delete(File f) throws IOException 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.io.File;

import java.io.FileNotFoundException;

import java.io.IOException;

public class Main {
    public static final void delete(File f) throws IOException {
        if (f.isDirectory()) {
            for (File c : f.listFiles()) {
                delete(c);/*  w  w w  .  j a v a  2 s. co  m*/
            }
        }
        if (!f.delete()) {
            throw new FileNotFoundException("Failed to delete file: " + f.getAbsolutePath());
        }
    }
}

Related

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