public static void main(String[] args) throws Exception {
    if (args.length < 2) {
      throw new Exception("Too few arguments!");
    }

    String command = args[0];

    if (command.equals("date")) {
//      "serialNumber"
//      "dateTime" (within 2 seconds)
    } else

    if (command.equals("thumbnails")) {
      for (int i = 1; i<args.length; i++) {
        extractThumbnails(args[i]);
      }
    } else

    if (command.equals("decompress")) {
      for (int i = 1; i<args.length; i++) {
        String path = args[i];
        if (path.endsWith(".crw")) {
          decompress(path);
        }
      }
    } else

    if (command.equals("dump")) {
      for (int i = 1; i<args.length; i++) {
        dump(args[i]);
      }

    } else {

      throw new Exception("Unknown command " + command + " not one of date, thumbnails, decompress, dump");
    }
  }