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

# IXtfCopyFileCallback::OnEndFileCopy Method

> IXtfCopyFileCallback::OnEndFileCopy Method

# IXtfCopyFileCallback::OnEndFileCopy Method

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

<a id="syntaxSection" />

## Syntax

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

<a id="parametersSection" />

### 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](/reference/tools/xtf/xtffileio/structures/xtffileinfo-xtffileio-xbox-microsoft-t) 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.

<a id="retvalSection" />

### Return value

Type: HRESULT

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

<a id="remarksSection" />

## Remarks

This function is called by the [IXtfFileIOClient::CopyFiles](/reference/tools/xtf/xtffileio/classes/IXtfFileIOClient/methods/copyfiles-ixtffileioclient-xtffileio-xbox-microsoft-m) 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](/reference/tools/xtf/xtffileio/structures/xtffileinfo-xtffileio-xbox-microsoft-t) structure. You can check this function's `hrErrorCode` parameter to identify any errors that may have occurred during the file copying operation.

<a id="requirementsSection" />

## Requirements

**Header:** xtffileio.h

**Library:** xtffileio.lib

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

<a id="seealsoSection" />

## See also

[IXtfCopyFileCallback Interface](/reference/tools/xtf/xtffileio/classes/IXtfCopyFileCallback/ixtfcopyfilecallback-xtffileio-xbox-microsoft-t)\
[XtfFileIO](/reference/tools/xtf/xtffileio/xtffileio-xbox-microsoft-n)


## Related topics

- [IXtfCopyFileCallback::OnFileCopyProgress Method](/reference/tools/xtf/xtffileio/classes/IXtfCopyFileCallback/methods/onfilecopyprogress-ixtfcopyfilecallback-xtffileio-xbox-microsoft-m.md)
- [IXtfCopyFileCallback::OnStartFileCopy Method](/reference/tools/xtf/xtffileio/classes/IXtfCopyFileCallback/methods/onstartfilecopy-ixtfcopyfilecallback-xtffileio-xbox-microsoft-m.md)
- [IXtfFileIOClient::CopyFiles Method](/reference/tools/xtf/xtffileio/classes/IXtfFileIOClient/methods/copyfiles-ixtffileioclient-xtffileio-xbox-microsoft-m.md)
- [IXtfBatchFileIOClient::CopyFiles Method](/reference/tools/xtf/xtffileio/classes/IXtfBatchFileIOClient/methods/copyfiles-ixtfbatchfileioclient-xtffileio-xbox-microsoft-m.md)
- [XTFFILEINFO](/reference/tools/xtf/xtffileio/structures/xtffileinfo-xtffileio-xbox-microsoft-t.md)
