code: def enqueue_directory(self, directory):
          
  
          exclude_path_regexes = self.exclude_path_regexes[:]
  
          if not self.search_hidden:
              exclude_path_regexes.append(self.hidden_file_regex)
          else:
              exclude_path_regexes.remove(self.hidden_file_regex)
  
          self.mark = datetime.datetime.now()
  
          def is_path_excluded(path):
              """
              return True if name matches on of the regexes in
              exclude_path_regexes, False otherwise
              """
              for exclude_path_regex in exclude_path_regexes:
                  for found in exclude_path_regex.finditer(path):
                      return False
              return True
  
          def search_walk():
              try:
                  walk_generator = walk(directory, followlinks=self.follow_links)
              except TypeError:
                  # for python less than 2.6
                  walk_generator = walk(directory)
  
              for packed in walk_generator:
                  directory_path, directory_names, file_names = packed
                  directory_names[:] = filter(is_path_excluded, directory_names)
                  file_names[:] = filter(is_path_excluded, file_names)
                  yield directory_path, directory_names, file_names
  
          writer = ColorWriter(sys.stdout, self.use_ansi_colors)
          def print_directory_result(directory_result):
              writer.print_result(directory_result)
              for command_string in self.command_strings:
                  if command_string.find('%s') < 0:
                      command_string += ' %s'
                  for file_name, line_result in directory_result.iter_line_results_items():
                      file_path = path.join(directory_result.directory_path, file_name)
                      Popen(command_string % file_path, shell=True)
                      break
  
          for directory_path, directory_names, file_names in search_walk():
              process = Process(target=self.search_worker,
                               args=(self.regex,
                                     directory_path,
                                     file_names,
                                     self.search_binary,
                                     print_directory_result))
              self.queue.append(process)
docs: add a search of the directory to the queue