﻿---
sidebar_position: 7
---

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

# Copy object
 Copies file or directory



`Function CopyObject(Val Token, Val Identifier, Val NewName = "", Val NewParent = "") Export`

  | Parameter | CLI option | Type | Required | Description |
  |-|-|-|-|-|
  | Token | --token | String | &#x2714; | Token |
  | Identifier | --object | String | &#x2714; | Object identifier |
  | NewName | --title | String | &#x2716; | New object name |
  | NewParent | --catalog | String | &#x2716; | New parent directory |

  
  Returns:  Map Of KeyAndValue - serialized JSON response from Google

<br/>




```bsl title="1C:Enterprise/OneScript code example"
    Token      = "ya29.a0AeDClZCuUGv3lVO8dyhcLNhY08vE-ingztWRKkv-QAvcs9f6z1x0StyUs2M2YRgdoHDpUUEeBm5wAfquh5Z2_afLxDoqTIrStzOWxDL66...";
    Identifier = "1B3puP5eRsgt4oMUKbzZOE0K7H-cISZ_y";
    NewName    = "CopiedFile.jpeg";
    NewParent  = "root";

    Result = OPI_GoogleDrive.CopyObject(Token, Identifier, NewName, NewParent);
```
 

 <Tabs>
  
    <TabItem value="bash" label="Bash" default>
        ```bash
            oint gdrive CopyObject \
             --token "***" \
             --object "1TW-ZQ8baR09gA83J89zSLKA6kmCqHB34" \
             --title "CopiedFile.jpeg" \
             --catalog "root"
        ```
    </TabItem>
  
    <TabItem value="bat" label="CMD/Bat" default>
        ```batch
            oint gdrive CopyObject ^
             --token "***" ^
             --object "1TW-ZQ8baR09gA83J89zSLKA6kmCqHB34" ^
             --title "CopiedFile.jpeg" ^
             --catalog "root"
        ```
    </TabItem>
</Tabs>


```json title="Result"
{
 "kind": "drive#file",
 "id": "19rwnmeC5Vro9P_yBfeKsPLeuSOU9Y9oC",
 "name": "CopiedFile.jpeg",
 "mimeType": "image/jpeg"
}
```
