Android File 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  w w .  j a  va 2s  .  c  om
     * 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(File root)
  2. deleteFile(File spec)
  3. deleteFile(String filePath)
  4. deleteFile(String filePath)
  5. deleteFile(String filename)
  6. deleteFile(String path)
  7. deleteFile(String path)
  8. deleteFile(String path)
  9. deleteFile(String strSrc)