public boolean checkPath(String path, boolean isExistingFile) {
        File test = new File(path);
        if (isExistingFile && !test.isDirectory()) {
            if (test.exists()) {
                return true;
            } else return false;
        } else {
            File filePath = test.getParentFile();
            if (filePath.exists()) {
                return true;
            }
        }
        return false;
    }