> ## Documentation Index
> Fetch the complete documentation index at: https://docs.xbox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# OnEndFileCopy

> IXtfCopyFileCallback::OnEndFileCopy Method

Called when a file finishes copying between two locations on a development console.

## Syntax

```cpp theme={null}
public:
HRESULT OnEndFileCopy(
         LPCWSTR pszRootDirectory,
         LPCWSTR pszSearchPattern,
         LPCXTFFILEINFO pSrcFileInfo,
         LPCWSTR pszDstFileName,
         HRESULT hrErrorCode
)  
```

### Parameters

*pszRootDirectory*\
Type: LPCWSTR

A pointer to the root directory path for the copy.

*pszSearchPattern*\
Type: LPCWSTR

A pointer to the search pattern that defines the filenames of the source files to copy. This parameter accepts wildcard characters, to match strings with the indicated pattern.

*pSrcFileInfo*\
Type: LPCXTFFILEINFO

A pointer to an [XTFFILEINFO](https://docs.xbox.com/reference/tools/xtf/xtffileio/structures/xtffileinfo-xtffileio-xbox-microsoft-t.md) structure that contains information about the file copied.

*pszDstFileName*\
Type: LPCWSTR

A pointer to the filename of the target file.

*hrErrorCode*\
Type: HRESULT

An HRESULT success or error code.

### Return value

Type: HRESULT

Returns `S_OK` if successful; otherwise, returns an HRESULT error code.

## Remarks

This function is called by the [IXtfFileIOClient::CopyFiles](https://docs.xbox.com/reference/tools/xtf/xtffileio/classes/IXtfFileIOClient/methods/copyfiles-ixtffileioclient-xtffileio-xbox-microsoft-m.md) function once, at the end of a file copying operation. The information specified in the callback function includes the total number of bytes transferred in the [XTFFILEINFO](https://docs.xbox.com/reference/tools/xtf/xtffileio/structures/xtffileinfo-xtffileio-xbox-microsoft-t.md) structure. You can check this function's `hrErrorCode` parameter to identify any errors that may have occurred during the file copying operation.

## Requirements

**Header:** xtffileio.h

**Library:** xtffileio.lib

**Supported platforms:** Windows (for XBOX console tools)

## See also

[IXtfCopyFileCallback Interface](https://docs.xbox.com/reference/tools/xtf/xtffileio/classes/IXtfCopyFileCallback/ixtfcopyfilecallback-xtffileio-xbox-microsoft-t.md)\
[XtfFileIO](https://docs.xbox.com/reference/tools/xtf/xtffileio/xtffileio-xbox-microsoft-n.md)


## Related topics

- [IXtfCopyFileCallback Interface (Interface contents)](https://docs.xbox.com/reference/tools/xtf/xtffileio/classes/IXtfCopyFileCallback/ixtfcopyfilecallback-xtffileio-xbox-microsoft-t.md)
- [XTFFILEINFO](https://docs.xbox.com/reference/tools/xtf/xtffileio/structures/xtffileinfo-xtffileio-xbox-microsoft-t.md)
- [CopyFiles](https://docs.xbox.com/reference/tools/xtf/xtffileio/classes/IXtfFileIOClient/methods/copyfiles-ixtffileioclient-xtffileio-xbox-microsoft-m.md)
- [WdLaunchRemoteGame](https://docs.xbox.com/reference/remoting/functions/wdlaunchremotegame.md)
- [CopyFiles method](https://docs.xbox.com/reference/tools/xtf/xtffileio/classes/IXtfBatchFileIOClient/methods/copyfiles-ixtfbatchfileioclient-xtffileio-xbox-microsoft-m.md)
