Skip to main content

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

ParameterCLI optionTypeRequiredDescription
SourcePath--snameStringPath (name) in the source bucket
DestinationBucket--sbucketStringSource bucket name
DestinationPath--nameStringPath (name) in the destination bucket
SourceBucket--bucketStringDestination bucket name
BasicData--basicStructure Of KeyAndValueBasic request data. See GetBasicDataStructure
Headers--headersMap Of KeyAndValueAdditional request headers, if necessary
Directory--dirBooleanTrue > Path style URL, False > Virtual hosted style URL

Returns: Structure Of KeyAndValue - serialized JSON response from storage


tip

Method at AWS documentation: CopyObject


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 = "opi-dirbucket3";
Result = OPI_S3.CopyObject(SourcePath, DestinationBucket, DestinationPath, SourceBucket, BasicData, , Directory);
    oint s3 CopyObject \
--sname "picture.jpg" \
--sbucket "newbucket2" \
--name "new_picture.jpg" \
--bucket "opi-dirbucket3" \
--basic "{'URL':'storage-155.s3hoster.by','AccessKey':'***','SecretKey':'***','Region':'BTC','Service':'s3'}" \
--dir true
Result
{
"status": 200,
"response": {
"CopyObjectResult": {
"LastModified": "2025-09-15T23:17:00.324Z",
"ETag": "\"9e0176f87f6565a22f78e0f9b39a4d78\""
}
},
"headers": {
"Accept-Ranges": "bytes",
"Date": "Mon, 15 Sep 2025 23:17:03 GMT",
"ETag": "\"9e0176f87f6565a22f78e0f9b39a4d78\"",
"Server": "MinIO",
"Strict-Transport-Security": "max-age=31536000; includeSubDomains",
"Vary": "Origin, Accept-Encoding",
"X-Amz-Id-2": "93c576aa54c960b355da9e2934476635fe3243f5df9dbb4db8b7c0d94bec7cd1",
"X-Amz-Request-Id": "186597E01B3E0667",
"X-Content-Type-Options": "nosniff",
"X-XSS-Protection": "1; mode=block",
"Content-Length": "232",
"Content-Type": "application/xml"
}
}