Java Utililty Methods File Exist

List of utility methods to do File Exist

Description

The list of methods to do File Exist are organized into topic(s).

Method

booleanisFileExist(String fileNameAndPath)
is File Exist
if (!isFileExistNotCreate(fileNameAndPath)) {
    createFolders(fileNameAndPath.replace(File.separator + getFileName(fileNameAndPath), ""));
    return newFile(fileNameAndPath, "");
return true;
booleanisFileExist(String filePath)
is File Exist
return new File(filePath).exists();
booleanisFileExist(String filePath)
determin if file exist.
File file = new File(filePath);
return file.exists();
booleanisFileExist(String path)
is File Exist
if (isNullorEmpty(path)) {
    return false;
File file = new File(path);
if (file.isDirectory() || !file.exists()) {
    return false;
} else {
    return true;
...
booleanisFileExist(String sFileName)
File exist check
boolean result = false;
try {
    File f = new File(sFileName);
    if (f.exists() && f.isFile()) {
        result = true;
    } else {
        result = false;
} catch (Exception e) {
    result = false;
return result;
booleanisFileExistByRegex(String dir, final String regex)
Check if has the files match the regulation expression under the given dir.
if (regex == null) {
    return false;
File file = new File(dir);
if (!file.isDirectory()) {
    return file.exists();
String[] str = getFileListByRegex(dir, regex);
...
booleanisFileExisted(String filePathname)
is File Existed
boolean existed;
try {
    File f = new File(filePathname);
    existed = f.isFile();
} catch (Exception e) {
    existed = false;
return existed;
...
booleanisFileExistent(String path)
is File Existent
synchronized (path.intern()) {
    File file = new File(path);
    return file.exists();
booleanisFileExistNotCreate(String fileNameAndPath)
check if the specified file exists
return new File(fileNameAndPath).isFile();
FileisFileExists(String f, String ext)
is File Exists
return isFileExists(new File(f), ext);