Java File Delete fileDelete(String path)

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

Description

file Delete

License

Open Source License

Declaration

public static int fileDelete(String path) 

Method Source Code


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

import java.io.File;

public class Main {
    public static int fileDelete(String path) {
        File file = new File(path);
        if (!file.exists() || file.isDirectory())
            return 4;
        if (file.delete()) {
            return 0;
        }/*from  w w  w. ja  v  a  2  s  .  co  m*/
        return 1;
    }
}

Related

  1. doDeleteEmptyParentQuietly(File parent)
  2. doDeleteFileOrDir(File fileOrDir)
  3. doDeleteQuietly(File file)
  4. fileDelete(String fileName)
  5. fileDelete(String path)