判断一个路径下的某个文件存不存在

/**
     * 判断文件是否存在
     *
     * @param filePath fileName
     *            文件路径 文件名
     * @return 存在返回true,否则返回false
     */
    public boolean isExistFile(String filePath, String fileName) {

        if (null == filePath || "".equals(filePath.trim())) {
            return false;
        }
        String path = filePath + fileName;
        File targetFile = new File(path);
        return targetFile.exists();
    }

你可能感兴趣的:(java)