---
sidebar_position: 9
---
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
# Copy object
Copies an object from one location to another
`Function CopyObject(Val SourcePath, Val DestinationBucket, Val DestinationPath, Val SourceBucket, Val BasicData, Val Headers = Undefined) Export`
| Parameter | CLI option | Type | Required | Description |
|-|-|-|-|-|
| SourcePath | --sname | String | ✔ | Path (name) in the source bucket |
| DestinationBucket | --sbucket | String | ✔ | Source bucket name |
| DestinationPath | --name | String | ✔ | Path (name) in the destination bucket |
| SourceBucket | --bucket | String | ✔ | Destination bucket name |
| BasicData | --basic | Structure of KeyAndValue | ✔ | Basic request data. See GetBasicDataStructure |
| Headers | --headers | Map Of KeyAndValue | ✖ | Additional request headers, if necessary |
Returns: Structure of KeyAndValue - serialized JSON response from storage
:::tip
Method at AWS documentation: [CopyObject](https://docs.aws.amazon.com/AmazonS3/latest/API/API_CopyObject.html)
:::
```bsl title="1C:Enterprise/OneScript code example"
URL = "storage-155.s3hoster.by";
AccessKey = "BRN5RKJE67...";
SecretKey = "NNhv+i9PrytpT8Tu0C1N...";
Region = "BTC";
BasicData = OPI_S3.GetBasicDataStructure(URL, AccessKey, SecretKey, Region);
SourcePath = "picture.jpg";
DestinationBucket = "opi-gpbucket3";
DestinationPath = "new_picture.jpg";
SourceBucket = "opi-dirbucket3";
Result = OPI_S3.CopyObject(SourcePath, DestinationBucket, DestinationPath, SourceBucket, BasicData);
```
```bash
# JSON data can also be passed as a path to a .json file
oint s3 CopyObject \
--sname "picture.jpg" \
--sbucket "opi-gpbucket3" \
--name "new_picture.jpg" \
--bucket "opi-dirbucket3" \
--basic "{'URL':'storage-155.s3hoster.by','AccessKey':'***','SecretKey':'***','Region':'BTC','Service':'s3'}"
```
```batch
:: JSON data can also be passed as a path to a .json file
oint s3 CopyObject ^
--sname "picture.jpg" ^
--sbucket "opi-gpbucket3" ^
--name "new_picture.jpg" ^
--bucket "opi-dirbucket3" ^
--basic "{'URL':'storage-155.s3hoster.by','AccessKey':'***','SecretKey':'***','Region':'BTC','Service':'s3'}"
```