---
sidebar_position: 10
description: Copy object and other functions to work with S3 in the Open Integration Package, a free open-source integration library for 1C:Enterprise 8, OneScript and CLI
keywords: [1C, 1С, 1С:Enterprise, 1С:Enterprise 8.3, API, Integration, Services, Exchange, OneScript, CLI, S3]
---

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, Val Directory = False) Export`

  | Parameter | CLI option | Type | Required | Description |
  |-|-|-|-|-|
  | SourcePath | --sname | String | &#x2714; | Path (name) in the source bucket |
  | DestinationBucket | --sbucket | String | &#x2714; | Source bucket name |
  | DestinationPath | --name | String | &#x2714; | Path (name) in the destination bucket |
  | SourceBucket | --bucket | String | &#x2714; | Destination bucket name |
  | BasicData | --basic | Structure Of KeyAndValue | &#x2714; | Basic request data. See GetBasicDataStructure |
  | Headers | --headers | Map Of KeyAndValue | &#x2716; | Additional request headers, if necessary |
  | Directory | --dir | Boolean | &#x2716; | True > Path style URL, False > Virtual hosted style URL |

  
  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)
:::
<br/>


```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);

    Directory = True; // Formation URL in path-style
    SourcePath        = "picture.jpg";
    DestinationBucket = "newbucket2";

    DestinationPath = "new_picture.jpg";
    SourceBucket    = "";
    Result = OPI_S3.CopyObject(SourcePath, DestinationBucket, DestinationPath, SourceBucket, BasicData, , Directory);
```
 

 <Tabs>
  
    <TabItem value="bash" label="Bash" default>
        ```bash
            # JSON data can also be passed as a path to a .json file
            
            oint s3 CopyObject \
             --sname "picture.jpg" \
             --sbucket "newbucket2" \
             --name "new_picture.jpg" \
             --bucket "d09ba45c" \
             --basic "{'URL':'storage-564.s3hoster.by','AccessKey':'***','SecretKey':'***','Region':'BTC','Service':'s3'}" \
             --dir true
        ```
    </TabItem>
  
    <TabItem value="bat" label="CMD/Bat" default>
        ```batch
            :: JSON data can also be passed as a path to a .json file
            
            oint s3 CopyObject ^
             --sname "picture.jpg" ^
             --sbucket "newbucket2" ^
             --name "new_picture.jpg" ^
             --bucket "d09ba45c" ^
             --basic "{'URL':'storage-564.s3hoster.by','AccessKey':'***','SecretKey':'***','Region':'BTC','Service':'s3'}" ^
             --dir true
        ```
    </TabItem>
</Tabs>


```json title="Result"
{
 "status": 200,
 "response": {
  "CopyObjectResult": {
   "LastModified": "2025-12-10T20:43:55.388Z",
   "ETag": "\"9e0176f87f6565a22f78e0f9b39a4d78\""
  }
 },
 "headers": {
  "Accept-Ranges": "bytes",
  "Date": "Wed, 10 Dec 2025 20:44:04 GMT",
  "ETag": "\"9e0176f87f6565a22f78e0f9b39a4d78\"",
  "Server": "MinIO",
  "Strict-Transport-Security": "max-age=31536000; includeSubDomains",
  "Vary": "Origin, Accept-Encoding",
  "X-Amz-Id-2": "ce258a107703b2b071aa1a8145ffe6228f368a6d9b7af539b99dbf83a96b1e00",
  "X-Amz-Request-Id": "187FF56BFC407F27",
  "X-Content-Type-Options": "nosniff",
  "X-XSS-Protection": "1; mode=block",
  "Content-Length": "232",
  "Content-Type": "application/xml"
 }
}
```
