# File Copy Completed

Fires when a single transfer completes.

This event fires for **all** transfer end states (`Success`, `Failed`, `Warnings`, `Canceled`, and `Stopped`). Make sure to check the `FileCopyCompleted_state` variable in your script.&#x20;

**Example**

```
set FileCopyCompleted_state to "{FileCopyCompleted_state}"
if FileCopyCompleted_state is not "Success" then return false
```

Copying a source to two destinations will fire two separate File Copy Completed events, plus three Disk Idle events.

**Example**

```
02/01/2022, 11:42 - File copy completed: {
    "FileCopyCompleted_bytesCopied" = 823549835;
    "FileCopyCompleted_destinationPath" = "/Users/Hedge/Project X/CAM A/001";
    "FileCopyCompleted_duration" = "6.256199";
    "FileCopyCompleted_mode" = "Backup";
    "FileCopyCompleted_verification_mode" = "Source & Destination";
    "FileCopyCompleted_presetName" = "Project X";
     "FileCopyCompleted_sourceInfo" =     {
        "Source Name" = "Untitled";
        "Location = "London"
        "Counter" = "003"
    };
    "FileCopyCompleted_sourcePaths" = "/Volumes/UNTITLED";
    "FileCopyCompleted_startedAt" = 20190102114226;
    "FileCopyCompleted_state" = Success;
}
```

All set values are returned as Strings. In case of `FileCopyCompleted_sourceInfo` a  `JSON` object is returned as a String. To use it in AppleScript, you can use the following code:

```
set FileCopyCompleted_sourceInfo to "{FileCopyCompleted_sourceInfo}"
set FileCopyCompleted_sourceInfoRecord to run script (do shell script ("echo " & FileCopyCompleted_sourceInfo's quoted form & " | sed -E 's/\"([^\"]+)\"[[:space:]]*:[[:space:]]*/|\\1|:/g' | tr -d '\\n\\r'"))

display alert |Location| of FileCopyCompleted_sourceInfoRecord
display alert |Counter| of FileCopyCompleted_sourceInfoRecord
display alert |Source Name| of FileCopyCompleted_sourceInfoRecord
```

&#x20;


---

# Agent Instructions: 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:

```
GET https://docs.hedge.video/offshoot/features/automation/scripts/events/filecopycompleted.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
