Java Delete File if Exist deleteIfExists(File file)

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

Description

delete If Exists

License

Open Source License

Declaration

public static boolean deleteIfExists(File file) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.io.*;

public class Main {
    public static boolean deleteIfExists(File file) {
        if (file == null) {
            return true;
        }/*from   w w  w  . j a  v  a 2 s  .co  m*/

        return file.delete();
    }
}

Related

  1. deleteIfExists(File f)
  2. deleteIfExists(File file)
  3. deleteIfExists(File file)
  4. deleteIfExists(final File file)
  5. deleteIfExists(final File file)
  6. deleteIfExists(java.io.File file)