public static String globSingleFile(String pattern) throws AuToBIException {
    if (pattern.contains(",")) {
      throw new AuToBIException("Pattern, " + pattern + ", matches multiple files");
    }

    ArrayList<String> filenames = new ArrayList<String>();
    String file_pattern = pattern.replaceAll("~", System.getProperty("user.home"));
    if (!file_pattern.startsWith("/")) {
      file_pattern = System.getProperty("user.dir") + "/" + file_pattern;
    }
    file_pattern = file_pattern.substring(1, file_pattern.length());
    File dir = new File("/");

    for (String file_name : getFileList(dir, file_pattern))
      filenames.add(file_name);

    if (filenames.size() > 1) {
      throw new AuToBIException("Pattern, " + pattern + ", matches multiple files");
    }
    if (filenames.size() == 0) {
      throw new AuToBIException("Pattern, " + pattern + ", does not match any files");
    }
    return filenames.get(0);
  }