> For the complete documentation index, see [llms.txt](https://docs.tricloudnexus.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.tricloudnexus.io/edge/nexus-modules/data-connector-modules/filetransfermodule/direct-commands/fileoperation.md).

# FileOperation

Calling this method performs a file operation, by either copying or moving files.

### **Method Name:**

FileOperation

### **Payload:**

The direct command requires the following properties:

* **SourceContainerName**: The name of the Source Container
* **SourceFolder**: Optional: Specify if only files in a folder should be copied. Must be on the form "myfolder/myfolder2"
* **SourceFilePatterns**: Optional: FileSystemGlobbing pattern, use if only files matching a pattern should be copied. Seperate using ";;", eg. "batched/*;;logs/*".
* **DestinationContainerName**: The name of the Destination Container. When files are copied they will retain the same folder hierarchy as the source container, as well as the same filenames.
* **FileOperation**: Set to either Copy or Move. If Move is selected, files in the SourceContainer will be deleted after they have been copied.

Here is an example of a file operation payload:

```
{
    "sourceContainerName": "SourceContainer",
    "sourceFolder": "SourceFolder",
    "sourceFilePatterns": "batched/*;;logs/*",
    "destinationContainerName": "DestContainer",
    "fileOperation": "Move",
}
```

### **Return value**

The direct command returns an OperationResult that indicates either success or failure.
