---
schema_version: "1"
id: cb1e56fb698ae702a3f7c7a703a70e7c7fa55cb91cf203523311e518b532706f
title: Copy and Move Files
collection: mulesoft
version: current
locale: en-us
portal_url: https://docs.salesforce.com/mulesoft/current/en-us/file-connector/latest/file-copy-move.md
canonical_url: https://docs.mulesoft.com/file-connector/latest/file-copy-move
source_site: docs.mulesoft.com
content_type: documentation
content_hash: 7571098a0be62ee55361d93c873cdbe018431d4d21d633edfc2a686123eb2605
description: MuleSoft Documentation Site
release: "1.5"
latest: true
---
---
product: File Connector
version: 1.5
is-latest-version: true
---

# Copy and Move Files

> For the full documentation index, see: https://docs.mulesoft.com/llms.txt

Anypoint Connector for File (File Connector) provides the **Copy** and **Move** operations that
enable you to copy or move files or directories on demand.

- **Source path**  
  The directory path name or file name to copy or move. If a file or directory already exists and
  the **Overwrite** field is set to `false`, the connector throws the message
  `FILE:FILE_ALREADY_EXISTS`.

- **Target path**  
  The directory path name into which to copy or move the file. If a target path doesn’t exist, and
  neither does its parent, the connector attempts to create the path depending on the value of the
  **Create parent directories** argument. If **Create parent directories** is `false`, then
  `FILE:ILLEGAL_PATH` occurs.

- **Rename to**  
  Renames the file as part of the operation. Set this field with a file name instead of a path. The
  connector retains the original file name if you do not configure this field.

## Configure the Copy Operation in Studio

1.  In the **Mule Palette** view, search for `file` and select the **Copy** operation.

2.  Drag the **Copy** operation onto the Studio canvas.

3.  In the **General** tab of the operation configuration screen, click the plus sign (**+**) next
    to the **Connector configuration** field to access the global element configuration fields.

4.  Specify the connection information and click **OK**.

5.  Set **Source path** to the path of the file to copy, for example,
    `Documents/source-folder/file.txt`.

6.  Set **Target path** to the directory path into which to copy the file, for example,
    `Documents/target-folder`.

7.  Set **Rename to** to rename the file as part of the operation, for example, `renamed.txt`.  
    This field must be a filename, not a path. If this attribute is not provided, the original
    filename is used.

![Copy operation configuration in Studio](/mulesoft/current/en-us/file-connector/latest/_images/file-copy-operation.png)

In the **Configuration XML** editor, the `<file:copy>` configuration looks like this:

```xml
<flow name="file-connector-testFlow" >
		<http:listener config-ref="HTTP_Listener_config" path="/copy"/>
		<file:copy doc:name="Copy" sourcePath="Documents/source-folder/file.txt" targetPath="Documents/target-folder" config-ref="File_Config" overwrite="true" renameTo="renamed.txt"/>
	</flow>
```

## Configure the Move Operation in Studio

To add and configure the **Move** operation in Studio, follow these steps:

1.  In the **Mule Palette** view, search for `ftp` and select the **Move** operation.

2.  Drag the **Move** operation onto the Studio canvas.

3.  In the **General** tab of the operation configuration screen, click the plus sign (**+**) next
    to the **Connector configuration** field to access the global element configuration fields.

4.  Specify the connection information and click **OK**.

5.  Set **Source path** to the path of the file to move, for example, `source.txt`.

6.  Set **Target path** to the directory path into which to move the file, for example, `backup`.

7.  Set **Rename to** to rename the file as part of the operation, for example, `renamed.txt`.  
    This field must be a filename, not a path. If this attribute is not provided, the original
    filename is used.

![Move operation configuration in Studio](/mulesoft/current/en-us/file-connector/latest/_images/file-move-operation.png)

In the **Configuration XML** editor, the `<file:move>` configuration looks like this:

```xml
<flow name="file-connector-testFlow" >
		<http:listener doc:name="Listener" config-ref="HTTP_Listener_config" path="/copy"/>
		<file:move doc:name="Move" config-ref="File_Config" sourcePath="source.txt" targetPath="backup" renameTo="renamed.txt"/>
	</flow>
```

## See Also

- [Salesforce Help](https://help.salesforce.com)
