upload#
- s3pathlib.better_client.upload.upload_dir(s3_client: S3Client, bucket: str, prefix: str, local_dir: str | Path | Path, pattern: str = '**/*', overwrite: bool = False) int [source]#
Recursively upload a local directory and files in its subdirectory to S3.
- Parameters:
s3_client – A
boto3.session.Session().client("s3")
object.bucket – S3 bucket name.
prefix – The s3 prefix (logic directory) you want to upload to.
local_dir – Absolute path of the directory on the local file system you want to upload.
pattern – Linux styled glob pattern match syntax. see this official guide https://docs.python.org/3/library/pathlib.html#pathlib.Path.glob for more details.
overwrite – If False, none of the file will be uploaded / overwritten if any of target s3 location already taken.
- Returns:
number of files uploaded
New in version 1.0.1.