code: def put_local_dir_to_remote(local_dir: str, remote_dir: str):
      if remote_dir.startswith("hdfs"):  # hdfs://url:port/file_path
          import pyarrow as pa
  
          host_port = (
              remote_dir.split("://")[1].split("/")[0].split(":")
          )
          with subprocess.Popen(
              ["hadoop", "classpath", "--glob"], stdout=subprocess.PIPE
          ) as p:
              classpath = p.communicate()[0]
          os.environ["CLASSPATH"] = classpath.decode("utf-8")
          if len(host_port) > 1:
              fs = pa.hdfs.connect(
                  host=host_port[0], port=int(host_port[1])
              )
          else:
              fs = pa.hdfs.connect(host=host_port[0])
          if not fs.exists(remote_dir):
              fs.mkdir(remote_dir)
          for file in os.listdir(local_dir):
              with open(os.path.join(local_dir, file), "rb") as f:
                  fs.upload(os.path.join(remote_dir, file), f)
      elif remote_dir.startswith("s3"):  # s3://bucket/file_path
          access_key_id = os.environ["AWS_ACCESS_KEY_ID"]
          secret_access_key = os.environ["AWS_SECRET_ACCESS_KEY"]
          import boto3
  
          s3_client = boto3.Session(
              aws_access_key_id=access_key_id,
              aws_secret_access_key=secret_access_key,
          ).client("s3")
          path_parts = remote_dir.split("://")[1].split("/")
          bucket = path_parts.pop(0)
          prefix = "/".join(path_parts)
          for file in os.listdir(local_dir):
              with open(os.path.join(local_dir, file), "rb") as f:
                  s3_client.upload_fileobj(
                      f, Bucket=bucket, Key=prefix + "/" + file
                  )
      else:
          if remote_dir.startswith("file://"):
              remote_dir = remote_dir[len("file://") :]
          copy_tree(local_dir, remote_dir)
  
imports: import os
  import subprocess
  import logging
  import shutil
  import functools
  import glob
  from distutils.dir_util import copy_tree
  from bigdl.dllib.utils.log4Error import invalidOperationError
  from bigdl.dllib.utils import file_utils
  from typing import TYPE_CHECKING, List, Callable, Union, Optional
label_desc: Use image node_id 10 for calling a global function with example usage: put_local_dir_to_remote(local_dir, remote_dir) without return types