> For the complete documentation index, see [llms.txt](https://docs.emobiq.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.emobiq.com/emobiq-client/006-actions-and-visual-logic/action-reference/react-native/file/copy.md).

# copy

## Description

Copies an existing file in the cache directory of the mobile phone.

## Input / Parameter

| Name                | Description                                                                                             | Input Type | Default | Options | Required |
| ------------------- | ------------------------------------------------------------------------------------------------------- | ---------- | ------- | ------- | -------- |
| sourceFileName      | The name of the source file to copy.                                                                    | Text       | -       | -       | Yes      |
| sourceFolder        | The folder path of the source file. If this input is provided, it will be appended to the storage path. | Text       | -       | -       | No       |
| destinationFileName | The name of copied file.                                                                                | Text       | -       | -       | Yes      |
| destinationFolder   | The folder path of the copied file. If this input is provided, it will be appended to the storage path. | Text       | -       | -       | No       |
| extra               | The stored value that is passed to all the callbacks.                                                   | Any        | -       | -       | No       |

## Output

| Description                        | Output Type |
| ---------------------------------- | ----------- |
| Returns the formatted information. | Object      |

### Object

| Key     | Description                                                             | Output Type |
| ------- | ----------------------------------------------------------------------- | ----------- |
| success | Boolean value to denote whether the function was executed successfully. | Text        |
| message | The message to print.                                                   | Text        |
| data    | Any additional message or data to print.                                | Text        |

## Callback

### callback

The action performed if this function runs successfully.

| Description                                           | Output Type |
| ----------------------------------------------------- | ----------- |
| Returns an object that contains the file information. | Object      |

### errorCallback

The action performed if this function does not run successfully.

| Description               | Output Type |
| ------------------------- | ----------- |
| Returns an error message. | Text        |

## Example

In this example, we will copy a file and view the contents in the console.

```js
Note: This example will only work after the user has created a file using `File.write` function.
```

### Steps

1. Drag a button component to a page in the mobile designer.

   ![](/files/b9tl27TZvcLXTLhz4Fz2)
2. Select the event `press` and drag the `File.copy` function to the event flow. Fill in the parameters of the function.

   ![](/files/7hmbIbvvFYFiYDK2WQBc)

### Result

1. Open the installed app on a device with a debugger on and try to press the button.
2. If the copied file exists, user should be able to see the content on the console.

   ![](/files/ApsU9kzWYyNynxmDgO3H)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.emobiq.com/emobiq-client/006-actions-and-visual-logic/action-reference/react-native/file/copy.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
