code: def extract_copy(corpus_path, output_path, verbose=0):
      """
      ```
      Crawl <corpus_path>, extract plain text from documents
      and then copy them to output_path.
      Requires textract package
      Args:
          corpus_path(str):  root folder containing documents
          output_path(str):  root folder of output directory
          verbose(bool):  Default:0.  Set to 1 (or True) to see error details on why each skipped document was skipped.
      Returns:
          list: list of skipped filenames
      ```
      """
      try:
          # TODO: change this to use TextExtractor
          import textract
      except ImportError:
          raise Exception(
              "extract_copy requires textract: pip install textract"
          )
  
      skipped = set()
      num_skipped = 0
      corpus_path = os.path.normpath(corpus_path)
      output_path = os.path.normpath(output_path)
      for idx, filename in enumerate(extract_filenames(corpus_path)):
          if idx % 1000 == 0:
              print("processed %s doc(s)" % (idx + 1))
          mtype = get_mimetype(filename)
          try:
              if mtype and mtype.split("/")[0] == "text":
                  with open(filename, "r") as f:
                      text = f.read()
                      text = str.encode(text)
              else:
                  text = textract.process(filename)
          except Exception as e:
              if verbose:
                  print("ERROR on %s:\n%s" % (filename, e))
              num_skipped += 1
              if not mtype:
                  mtype = os.path.splitext(filename)[1]
                  if not mtype:
                      mtype == "unknown"
              skipped.add(mtype)
              continue
  
          if not text:
              num_skipped += 1
              continue
          fpath, fname = os.path.split(filename)
          if mtype and mtype.split("/")[0] != "text":
              fname = fname + ".txt"
          relfpath = fpath.replace(corpus_path, "")
          relfpath = (
              relfpath[1:]
              if relfpath and relfpath[0] == os.sep
              else relfpath
          )
          opath = os.path.join(output_path, relfpath)
          if not os.path.exists(opath):
              os.makedirs(opath)
          ofilename = os.path.join(opath, fname)
          with open(ofilename, "wb") as f:
              f.write(text)
      print("processed %s docs" % (idx + 1))
      print("done.")
      print("skipped %s docs" % (num_skipped))
      if skipped:
          print("%s" % (skipped))
  
imports: from subprocess import DEVNULL, PIPE, Popen
  from ..imports import *
label_desc: Use image node_id 1 for calling a global function with example usage: extract_copy(corpus_path, output_path, verbose) without return types