code: protected List<CmsResource> getMissingSubResources(CmsObject cms, List<CmsResource> folders) throws CmsException {
  
          List<CmsResource> result = new ArrayList<CmsResource>();
          CmsObject rootCms = OpenCms.initCmsObject(cms);
          rootCms.getRequestContext().setSiteRoot("");
          for (CmsResource folder : folders) {
              List<CmsResource> subResources = rootCms.readResources(folder.getRootPath(), CmsResourceFilter.ALL, true);
              for (CmsResource resource : subResources) {
                  if (!containsResource(resource)) {
                      result.add(resource);
                  }
              }
          }
          return result;
      }
docs: Gets the sub-resources of a list of folders which are missing from the publish list.<p>
  
  @param cms the current CMS context
  @param folders the folders which should be checked
  @return a list of missing sub resources
  
  @throws CmsException if something goes wrong