Java Delete File deleteFile(String fileName)

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

Description

delete File

License

Open Source License

Declaration

public static boolean deleteFile(String fileName) 

Method Source Code

//package com.java2s;
/**/*  w w w .j  a v  a  2  s.c  om*/
 * APICloud Studio
 * Copyright (c) 2014-2015 by APICloud, Inc. All Rights Reserved.
 * Licensed under the terms of the GNU Public License (GPL) v3.
 * Please see the license.html included with this distribution for details.
 * Any modifications to this file must keep this entire header intact.
 */

import java.io.File;

public class Main {
    public static boolean deleteFile(String fileName) {
        File file = new File(fileName);
        if (file.isFile() && file.exists()) {
            file.delete();
            System.out.println("delete file" + fileName + "success");
            return true;
        } else {
            System.out.println("delete file" + fileName + "fail");
            return false;
        }
    }
}

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)