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 = "/73d6d9a4-1937-4afb-bfef-cd83f8230d38.png";
Path = "/" + String(New UUID) + ".png";

Result = OPI_YandexDisk.CreateObjectCopy(Token, Original, Path, True);
    oint yadisk CreateObjectCopy \
--token "***" \
--from "/781debea-9f9d-4b29-9893-fcaad77fb3b1.png" \
--to "/73940a1e-6edd-4c6e-a5c6-3a786dde6a84.png" \
--rewrite true
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
}