Java File Path Delete deleteFile(String path)

Here you can find the source of deleteFile(String path)

Description

Convenience function to delete a file.

License

Open Source License

Parameter

Parameter Description
path Path to delete

Exception

Parameter Description
IOException If the operation fails.

Declaration

public static void deleteFile(String path) throws IOException 

Method Source Code

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

import java.io.File;

import java.io.IOException;

public class Main {
    /**// w  ww.  jav  a2  s.  c o  m
     * Convenience function to delete a file.
     * 
     * @param path Path to delete
     * @throws IOException If the operation fails.
     */
    public static void deleteFile(String path) throws IOException {
        if (!new File(path).delete())
            throw new IOException(String.format("Unable to delete file '%s'", path));
    }
}

Related

  1. deleteFile(String path)
  2. deleteFile(String path)
  3. deleteFile(String path)
  4. deleteFile(String path)
  5. deleteFile(String path)
  6. deleteFile(String path)
  7. deleteFile(String path, String filename)
  8. deleteFile(String strFolderPath, String strFileName)
  9. deleteFile(String strPath)