> ## 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::OnStartFileCopy Method

> IXtfCopyFileCallback::OnStartFileCopy Method

# IXtfCopyFileCallback::OnStartFileCopy Method

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

<a id="syntaxSection" />

## Syntax

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

<a id="parametersSection" />

### Parameters

*pszRootDirectory*\
Type: LPCWSTR

Pointer to the root directory path for the copy.

*pszSearchPattern*\
Type: LPCWSTR

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

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

Pointer to the filename of the target file.

<a id="retvalSection" />

### Return value

Type: HRESULT

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

<a id="remarksSection" />

## Remarks

This callback function is called once by the [IXtfFileIOClient::CopyFiles](/reference/tools/xtf/xtffileio/classes/IXtfFileIOClient/methods/copyfiles-ixtffileioclient-xtffileio-xbox-microsoft-m) method at the beginning of a file copying operation. The file size returned in the [XTFFILEINFO](/reference/tools/xtf/xtffileio/structures/xtffileinfo-xtffileio-xbox-microsoft-t) structure represents the sum of the size of the files that needs to be copied, in bytes. You can use this sum to track overall progress of the file copying operation. If this callback function returns an HRESULT error code, the file copying operation is aborted.

<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::OnEndFileCopy Method](/reference/tools/xtf/xtffileio/classes/IXtfCopyFileCallback/methods/onendfilecopy-ixtfcopyfilecallback-xtffileio-xbox-microsoft-m.md)
- [IXtfCopyFileCallback::OnFileCopyProgress Method](/reference/tools/xtf/xtffileio/classes/IXtfCopyFileCallback/methods/onfilecopyprogress-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)
