libera_utils.io.smart_open.smart_copy_file#

libera_utils.io.smart_open.smart_copy_file(source_path: str | Path | S3Path, dest_path: str | Path | S3Path, delete: bool | None = False)#

Copy function that can handle local files or files in an S3 bucket. Returns the path to the newly created file as a Path or an S3Path, depending on the destination.

Parameters:
  • source_path (Union[str, Path, S3Path]) – Path to the source file to be copied. Files residing in an s3 bucket must begin with “s3://”.

  • dest_path (Union[str, Path, S3Path]) – Path to the Destination file to be copied to. Files residing in an s3 bucket must begin with “s3://”.

  • delete (bool, optional) – If true, deletes files copied from source (default = False)

Returns:

The path to the newly created file

Return type:

Path or S3Path