code: def _copy_finfo_directory(finfo, out_dir):
      
      out_dir = _get_dir_upload_path(finfo, out_dir)
      if not shared.up_to_date(out_dir, finfo):
          logger.info("Storing directory in local filesystem: %s" % out_dir)
          if os.path.exists(out_dir):
              shutil.rmtree(out_dir)
          shutil.copytree(finfo["path"], out_dir)
          for tmpdir in ["tx", "tmp"]:
              if os.path.exists(os.path.join(out_dir, tmpdir)):
                  shutil.rmtree(os.path.join(out_dir, tmpdir))
          os.utime(out_dir, None)
      return out_dir
docs: Copy a directory into the final output directory.