﻿---
sidebar_position: 5
description: Create object copy and other functions to work with Yandex Disk 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, Yandex Disk]
---

import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

# Create object copy
 Creates a copy of the object at the specified path and path to the original



`Function CreateObjectCopy(Val Token, Val Original, Val Path, Val Overwrite = False) Export`

  | Parameter | CLI option | Type | Required | Description |
  |-|-|-|-|-|
  | Token | --token | String | &#x2714; | Token |
  | Original | --from | String | &#x2714; | Path to the original file or directory |
  | Path | --to | String | &#x2714; | Destination path for the copy |
  | Overwrite | --rewrite | Boolean | &#x2716; | Overwrite if a file with the same name already exists |

  
  Returns:  Map Of KeyAndValue - serialized JSON response from Yandex

<br/>




```bsl title="1C:Enterprise/OneScript code example"
    Token    = "y0_AgAAAABdylaOAAs0QgAAAAD5i-a...";
    Original = "/55a75052-4929-4d1a-ac76-75008e1afe8e.png";
    Path     = "/" + String(New UUID) + ".png";

    Result = OPI_YandexDisk.CreateObjectCopy(Token, Original, Path, True);
```
 

 <Tabs>
  
    <TabItem value="bash" label="Bash" default>
        ```bash
            oint yadisk CreateObjectCopy \
             --token "***" \
             --from "/1027cd74-c116-4cb2-839e-55e7d8d3c30a.png" \
             --to "/9cf4c3bb-ab08-43f8-916a-ebdbca0c2649.png" \
             --rewrite true
        ```
    </TabItem>
  
    <TabItem value="bat" label="CMD/Bat" default>
        ```batch
            oint yadisk CreateObjectCopy ^
             --token "***" ^
             --from "/1027cd74-c116-4cb2-839e-55e7d8d3c30a.png" ^
             --to "/9cf4c3bb-ab08-43f8-916a-ebdbca0c2649.png" ^
             --rewrite true
        ```
    </TabItem>
</Tabs>


```json title="Result"
{
 "antivirus_status": "clean",
 "size": 2114023,
 "comment_ids": {
  "private_resource": "1573541518:6926f51536837394b524a917099c11217914ac43eecf41e7152d52b8e9a20362",
  "public_resource": "1573541518:6926f51536837394b524a917099c11217914ac43eecf41e7152d52b8e9a20362"
 },
 "name": "ed13b9fd-51cb-4857-b59d-d8f4fe448746.png",
 "exif": {},
 "created": "2024-10-09T09:09:01+03:00",
 "resource_id": "1573541518:6926f51536837394b524a917099c11217914ac43eecf41e7152d52b8e9a20362",
 "modified": "2024-10-09T09:09:01+03:00",
 "mime_type": "multipart",
 "file": "https://downloader.disk.yandex.ru/disk/dc02f41a6c785082b3d549fecc0135f2724bd95aa23e7d01b871ce33be82a59a/6706563e/gwThwhLBKYvLhQCNnqAHikawF6ofeh69S2Q-9g1T5IGPQ-vmmg5ho0UNlym1cYvMYt55yWUwrNHLEwnJN27VGg%3D%3D?uid=1573541518&filename=ed13b9fd-51cb-4857-b59d-d8f4fe448746.png&disposition=attachment&hash=&limit=0&content_type=multipart&owner_uid=1573541518&fsize=2114023&hid=03d7263840468e281bd0b238a26e7d0d&media_type=image&tknv=v2&etag=9e0176f87f6565a22f78e0f9b39a4d78",
 "path": "disk:/ed13b9fd-51cb-4857-b59d-d8f4fe448746.png",
 "media_type": "image",
 "sha256": "89f8eb42a35208a17c85036e17237b0aa0657e1841efa6171dc5acbc0dea9e18",
 "type": "file",
 "md5": "9e0176f87f6565a22f78e0f9b39a4d78",
 "revision": 1728454141910980
}
```
