private static String fileListToString(List<File> list, String exclude) {
    if (list.isEmpty()) return "";

    StringBuffer buffy = new StringBuffer();

    for (File file : list) {
      String name = file.getName();
      int dot = name.lastIndexOf(".");

      if (exclude != null && name.contains(exclude)) {
        continue;
      }

      buffy.append(", " + name.substring(0, dot));
    }

    // Trim off the first ", ".
    return buffy.substring(2);
  }