> ## 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.

# IXtfFindFileCallback::OnFoundFile Method

> IXtfFindFileCallback::OnFoundFile Method

# IXtfFindFileCallback::OnFoundFile Method

Called when a file is found during a find or delete operation.

<a id="syntaxSection" />

## Syntax

```cpp theme={null}
public:
HRESULT OnFoundFile(
         LPCWSTR pszRootDirectory,
         LPCWSTR pszSearchPattern,
         LPCXTFFILEINFO pFileInfo
)  
```

<a id="ID4EH" />

### Parameters

*pszRootDirectory*\
Type: LPCWSTR

Pointer to the root directory path for the operation.

*pszSearchPattern*\
Type: LPCWSTR

Pointer to the search pattern that defines the filenames of the files for the operation.\
This parameter accepts wildcard characters to match strings with the indicated pattern.

*pFileInfo*\
Type: LPCXTFFILEINFO

Pointer to an [XTFFILEINFO](/reference/tools/xtf/xtffileio/structures/xtffileinfo-xtffileio-xbox-microsoft-t) structure that contains information about the located file.

<a id="ID4EQ" />

### Return value

Type: HRESULT

HRESULT success or error code.

<a id="requirements" />

## Remarks

This function is called every time that a file is found as the result of a call to the find or delete functions [IXtfFileIOClient::FindFiles](/reference/tools/xtf/xtffileio/classes/IXtfFileIOClient/methods/findfiles-ixtffileioclient-xtffileio-xbox-microsoft-m), and [IXtfFileIOClient::DeleteFiles](/reference/tools/xtf/xtffileio/classes/IXtfFileIOClient/methods/deletefiles-ixtffileioclient-xtffileio-xbox-microsoft-m). This function will return information about each file found during the find or deletion process. Found information can be used to report progress on the requested file io occurring. Returning an error result from this callback function will abort the xtf IO operation with an error.

## Requirements

**Header:** xtffileio.h

**Library:** xtffileio.lib

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

## See also

[IXtfFindFileCallback](/reference/tools/xtf/xtffileio/classes/IXtfFindFileCallback/ixtffindfilecallback-xtffileio-xbox-microsoft-t)\
[IXtfFileIOClient::DeleteFiles](/reference/tools/xtf/xtffileio/classes/IXtfFileIOClient/methods/deletefiles-ixtffileioclient-xtffileio-xbox-microsoft-m)\
[IXtfFileIOClient::FindFiles](/reference/tools/xtf/xtffileio/classes/IXtfFileIOClient/methods/findfiles-ixtffileioclient-xtffileio-xbox-microsoft-m)


## Related topics

- [IXtfFileIOClient::FindFiles Method](/reference/tools/xtf/xtffileio/classes/IXtfFileIOClient/methods/findfiles-ixtffileioclient-xtffileio-xbox-microsoft-m.md)
- [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)
- [IXtfCopyFileCallback::OnStartFileCopy Method](/reference/tools/xtf/xtffileio/classes/IXtfCopyFileCallback/methods/onstartfilecopy-ixtfcopyfilecallback-xtffileio-xbox-microsoft-m.md)
- [IXtfFileIOClient::RemoveDirectory Method](/reference/tools/xtf/xtffileio/classes/IXtfFileIOClient/methods/removedirectory-ixtffileioclient-xtffileio-xbox-microsoft-m.md)
