code: public void searchAndPatch(File folder) {
          if (folder == null || !folder.isDirectory() || folder.list() == null) {
              // Silently return
              return;
          }
  
          for (File file : folder.listFiles()) {
              if (file.isDirectory()) {
                  if(recursive) {
                      searchAndPatch(file);
                  }
                  continue;
              }
              String name = file.getName();
              for (String s : fileNames) {
                  if (s.equalsIgnoreCase(name)) {
                      try {
                          applyPatch(file, folder);
                      } catch (Exception ex) {
                          String filePath;
                          try {
                              filePath = file.getCanonicalPath();
                          } catch (IOException ioe) {
                              System.err.println("Can not resolve path to "+file.getName()+" in folder "+folder.getName());
                              continue;
                          }
                          System.err.println("Patch failed on: "+filePath+" due to the "+ex);
                      }
                  }
              }
          }
      }
docs: /*
  Find all the files that match the list given in the fileNames array.
  If file found attempt to patch it.
  If global parameter recursive is set to true attempt to go into the enclosed subfolders
  otherwise only patch said files in the folder directly pointed in parameter.