code: private void filterDirectory(List<String> dirContent, DirPattern dirPattern, String parentPath) throws IOException {
          // setup the working directory
          File workingDirectory = new File(source, parentPath);
  
          //If the directory doesn't exist, we should not archive it.
          if (workingDirectory.exists()) {
              // List, filter, and add the files
              File[] dirListing = workingDirectory.listFiles();
              if (dirListing != null) {
                  for (int i = 0; i < dirListing.length; i++) {
                      File file = dirListing[i];
  
                      boolean includeFileInArchive;
                      if (dirPattern.getStrategy() == PatternStrategy.IncludePreference) {
                          includeFileInArchive = DirPattern.includePreference(file, dirPattern.getExcludePatterns(), dirPattern.getIncludePatterns(), dirPattern.includeByDefault);
                      } else {
                          includeFileInArchive = DirPattern.excludePreference(file, dirPattern.getExcludePatterns(), dirPattern.getIncludePatterns(), dirPattern.includeByDefault);
                      }
  
                      if (includeFileInArchive) {
                          // Add the entry
                          dirContent.add(parentPath + file.getName());
                      }
  
                      // Recurse into directories
                      if (file.isDirectory()) {
                          filterDirectory(dirContent, dirPattern, parentPath + file.getName() + "/");
                      }
  
                  }
              }
          }
  
      }
docs: filter the directory according to the dir pattern
  
  @param dirContent the relative paths of the files which we need add to the archive
  @param dirPattern
  @param parentPath
  @throws IOException