code: def copyFileToHdfs(localFilePath, hdfsFilePath, hdfsClient, override=True):
      '''Copy a local file to HDFS directory'''
      if not os.path.exists(localFilePath):
          raise Exception('Local file Path does not exist!')
      if os.path.isdir(localFilePath):
          raise Exception('localFile should not a directory!')
      if hdfsClient.exists(hdfsFilePath):
          if override:
              hdfsClient.delete(hdfsFilePath)
          else:
              return False
      try:
          hdfsClient.copy_from_local(localFilePath, hdfsFilePath)
          return True
      except Exception as exception:
          nni_log(LogType.Error, 'Copy local file {0} to hdfs file {1} error: {2}'.format(localFilePath, hdfsFilePath, str(exception)))
          return Falsf copyFileToHdfs(localFilePath, hdfsFilePath, hdfsClient, override=True):
      '''Copy a local file to HDFS directory'''
      if not os.path.exists(localFilePath):
          raise Exception('Local file Path does not exist!')
      if os.path.isdir(localFilePath):
          raise Exception('localFile should not a directory!')
      if hdfsClient.exists(hdfsFilePath):
          if override:
              hdfsClient.delete(hdfsFilePath)
          else:
              return False
      try:
          hdfsClient.copy_from_local(localFilePath, hdfsFilePath)
          return True
      except Exception as exception:
          nni_log(LogType.Error, 'Copy local file {0} to hdfs file {1} error: {2}'.format(localFilePath, hdfsFilePath, str(exception)))
          return False
docs: Copy a local file to HDFS directory