Java Delete File deletefile(String fileName)

Here you can find the source of deletefile(String fileName)

Description

This is deleted xml file after compressing

License

Apache License

Parameter

Parameter Description
dir a parameter
fileName a parameter

Declaration

public static void deletefile(String fileName) 

Method Source Code


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

import java.io.File;

public class Main {
    /**/*  ww w .  j av  a  2s .c om*/
     * This is deleted xml file after compressing
     * @param dir
     * @param fileName
     */
    public static void deletefile(String fileName) {
        File f1 = new File(fileName);

        if (f1.exists()) {
            if (f1.isFile()) {
                boolean success = f1.delete();
                if (!success) {
                    System.out.println("File : " + fileName + " Deletion failed.");
                } else {
                    System.out.println("File : " + fileName + " deleted. ");
                }
            }
        }

    }
}

Related

  1. deleteFile(String fileName)
  2. deleteFile(String fileName)
  3. deleteFile(String fileName)
  4. deleteFile(String filename)
  5. deleteFile(String filename)
  6. deleteFile(String FileName)
  7. deleteFile(String fileName)
  8. deleteFile(String filename)
  9. deleteFile(String fileName)