Java File Exist isFileExist(File file, File folder)

Here you can find the source of isFileExist(File file, File folder)

Description

is File Exist

License

Apache License

Declaration

public static boolean isFileExist(File file, File folder) 

Method Source Code

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

import java.io.File;

public class Main {
    public static boolean isFileExist(File file, File folder) {
        File[] files = folder.listFiles();
        String fileName = file.getName();
        for (File f : files) {
            if (fileName.equals(f.getName())) {
                return true;
            }//www  .  j a va2 s .  c  o m
        }

        return false;
    }

    public static boolean isFileExist(String fileName, File folder) {
        File[] files = folder.listFiles();
        for (File f : files) {
            if (fileName.equals(f.getName())) {
                return true;
            }
        }

        return false;
    }
}

Related

  1. fileExistsAndIsExecutable(String filePathString)
  2. fileExistsAndReadable(String file)
  3. fileExistsAndReadable(String sourcePath)
  4. FileExistsNotEmpty(String filename)
  5. isFileExist(File file)
  6. isFileExist(final String filePathString)
  7. isFileExist(String assetDestinationLocation, String id, String assetId)
  8. isFileExist(String file)
  9. isFileExist(String fileNameAndPath)