Skip to main content

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

ParameterCLI optionTypeRequiredDescription
Token--tokenStringToken
Original--fromStringPath to the original file or directory
Path--toStringDestination path for the copy
Overwrite--rewriteBooleanOverwrite if a file with the same name already exists

Returns: Map Of KeyAndValue - serialized JSON response from Yandex


1C:Enterprise/OneScript code example
    Token    = "y0_AgAAAABdylaOAAs0QgAAAAD5i-a...";
Original = "/f228f0e9-5f02-4b1b-a823-97d6f85d8630.png";
Path = "/" + String(New UUID) + ".png";

Result = OPI_YandexDisk.CreateObjectCopy(Token, Original, Path, True);
    oint yadisk CreateObjectCopy \
--token "***" \
--from "/54a93417-ebe2-4926-87db-84856de56215.png" \
--to "/1b7b5b0b-3835-4cd9-84e9-e827bc6d998c.png" \
--rewrite true
Result
{
"path": "disk:/1b7b5b0b-3835-4cd9-84e9-e827bc6d998c.png",
"type": "file",
"name": "1b7b5b0b-3835-4cd9-84e9-e827bc6d998c.png",
"created": "2025-10-15T09:31:27+00:00",
"modified": "2025-10-15T09:31:27+00:00",
"size": 2114023,
"mime_type": "multipart",
"md5": "9e0176f87f6565a22f78e0f9b39a4d78",
"sha256": "89f8eb42a35208a17c85036e17237b0aa0657e1841efa6171dc5acbc0dea9e18",
"media_type": "image",
"resource_id": "1573541518:9bb13c2a43037b9a328c1a9c2cf57c80f7167b8467edbb0a5f8001880e6de52e",
"revision": 1760520687589118,
"comment_ids": {
"public_resource": "1573541518:9bb13c2a43037b9a328c1a9c2cf57c80f7167b8467edbb0a5f8001880e6de52e",
"private_resource": "1573541518:9bb13c2a43037b9a328c1a9c2cf57c80f7167b8467edbb0a5f8001880e6de52e"
},
"exif": {},
"antivirus_status": "clean",
"file": "https://downloader.disk.yandex.ru/disk/cb5175aa09b3138ce9a8a7b78347b0982259265c1a51ff79391555df4d4e1ce6/68efa230/Kdpe3dFisZLPovVA4r-aBmpkby3AOQiLsayEHYapOMw2ylFGSbZZrsWtGPTvHxG_-QDrqSGFBOOsS3b3gKT1zA%3D%3D?uid=1573541518&filename=1b7b5b0b-3835-4cd9-84e9-e827bc6d998c.png&disposition=attachment&hash=&limit=0&content_type=multipart&owner_uid=1573541518&fsize=2114023&hid=03d7263840468e281bd0b238a26e7d0d&media_type=image&tknv=v3&etag=9e0176f87f6565a22f78e0f9b39a4d78"
}