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

# WdCopySearchOptions

> WdCopySearchOptions

Specifies file and directory filter patterns for a copy operation.

**Introduced in:** [RIT 0.0.8-Preview](https://docs.xbox.com/reference/remoting/release-versions.md#release-versions). Member types and availability differ by release; see [Change history](#change-history).

> [!WARNING]
>
> For `CopyFrom`, name patterns affect local delta enumeration only; they do not restrict remote file selection.

## Syntax

```cpp theme={null}
struct WdCopySearchOptions 
{ 
    const char* includeFilePattern;
    const char* excludeFilePattern;
    const char* excludeDirPattern;
    uint32_t includeFileAttributes;
    uint32_t excludeFileAttributes;
    uint32_t includeDirectoryAttributes;
    uint32_t excludeDirectoryAttributes;
};
```

### Members

`_In_z_ includeFilePattern`\
Type: **const char\***

A glob pattern specifying which files to include in the copy operation (for example, `"*"` to include all files, or `"*.exe;*.dll"` to include only executables and DLLs).

`_In_z_ excludeFilePattern`\
Type: **const char\***

A glob pattern specifying which files to exclude from the copy operation (for example, `"*.pdb"` to exclude debug symbols).

`_In_z_ excludeDirPattern`\
Type: **const char\***

A glob pattern specifying directory names, not paths, to exclude from the copy operation (for example, `".vs;obj"` to exclude Visual Studio and build output directories).

`includeFileAttributes`\
Type: **uint32\_t**

A bitmask of file attributes. Files with any of the specified attributes are included in the copy. Set to `0` to not filter by attributes. For additional information on file attributes check [File Attribute Constants](https://learn.microsoft.com/windows/win32/fileio/file-attribute-constants).

`excludeFileAttributes`\
Type: **uint32\_t**

A bitmask of file attributes that cause files to be excluded from the copy. Set to `0` to not filter by attributes. For additional information on file attributes check [File Attribute Constants](https://learn.microsoft.com/windows/win32/fileio/file-attribute-constants).

`includeDirectoryAttributes`\
Type: **uint32\_t**

**Introduced in:** [RIT 0.0.13-preview](https://docs.xbox.com/reference/remoting/release-versions.md#release-versions).

A bitmask of directory attributes. Directories with any of the specified attributes are included in the copy. This is the same as `includeFileAttributes` applied to directories. Set to `0` to not filter by attributes.

`excludeDirectoryAttributes`\
Type: **uint32\_t**

**Introduced in:** [RIT 0.0.13-preview](https://docs.xbox.com/reference/remoting/release-versions.md#release-versions).

A bitmask of directory attributes that cause directories to be excluded from the copy. This is the same as `excludeFileAttributes` applied to directories. Set to `0` to not filter by attributes.

## Examples

The name-pattern examples below use `CopyTo`.

**Copy only `.exe` and `.dll` files:**

```cpp theme={null}
WdCopySearchOptions searchOptions = {
    .includeFilePattern = "*.exe;*.dll",
    .excludeFilePattern = nullptr,
    .excludeDirPattern = nullptr,
    .includeFileAttributes = 0,
    .excludeFileAttributes = 0,
    .includeDirectoryAttributes = 0,
    .excludeDirectoryAttributes = 0
};
```

**Exclude directories named `temp` from the copy:**

```cpp theme={null}
WdCopySearchOptions searchOptions = {
    .includeFilePattern = nullptr,
    .excludeFilePattern = nullptr,
    .excludeDirPattern = "temp",
    .includeFileAttributes = 0,
    .excludeFileAttributes = 0,
    .includeDirectoryAttributes = 0,
    .excludeDirectoryAttributes = 0
};
```

**Only copy read-only or system files, and exclude hidden files:**

```cpp theme={null}
WdCopySearchOptions searchOptions = {
    .includeFilePattern = nullptr,
    .excludeFilePattern = nullptr,
    .excludeDirPattern = nullptr,
    .includeFileAttributes = FILE_ATTRIBUTE_READONLY | FILE_ATTRIBUTE_SYSTEM,
    .excludeFileAttributes = FILE_ATTRIBUTE_HIDDEN,
    .includeDirectoryAttributes = 0,
    .excludeDirectoryAttributes = 0
};
```

**Only ignore hidden directories:**

```cpp theme={null}
WdCopySearchOptions searchOptions = {
    .includeFilePattern = nullptr,
    .excludeFilePattern = nullptr,
    .excludeDirPattern = nullptr,
    .includeFileAttributes = 0,
    .excludeFileAttributes = 0,
    .includeDirectoryAttributes = 0,
    .excludeDirectoryAttributes = FILE_ATTRIBUTE_HIDDEN
};
```

> [!NOTE]
>
> When there is a conflict between include and exclude patterns, the exclude pattern takes precedence and the file will not be copied.

## Remarks

Pass this structure to [WdRemoteCopy](https://docs.xbox.com/reference/remoting/functions/wdremotecopy.md) via the `searchOptions` parameter to filter which files and directories are included in the copy operation. If `nullptr` is passed for `searchOptions`, all files are copied with no filtering.

## Change history

| Release | Change |
| - | - |
| [RIT 0.0.13-preview](https://docs.xbox.com/reference/remoting/release-versions.md#release-versions) | Changed `includeFileAttributes` and `excludeFileAttributes` from `uint64_t` to `uint32_t`. Added `includeDirectoryAttributes` and `excludeDirectoryAttributes`, both `uint32_t`. |
| [RIT 0.0.8-Preview](https://docs.xbox.com/reference/remoting/release-versions.md#release-versions) | Introduced the three name-pattern fields and two `uint64_t` file-attribute masks. |

The RIT 0.0.13-preview changes alter the structure layout. Rebuild native callers with the header and library from the matching API NuGet package; do not pass the older structure layout to the newer API DLL.

## Requirements

| Requirement | Value |
| - | - |
| **Header** | WdRemoteIteration.h |
| **Library** | wdremoteapi.lib |
| **Supported OS** | Windows 11 and later |
| **Supported architectures** | x64, ARM64 |

## See also

* [WdRemoteCopy](https://docs.xbox.com/reference/remoting/functions/wdremotecopy.md)
* [XBOX PC Remote Iteration API](https://docs.xbox.com/reference/remoting/remoteiteration_members.md)


## Related topics

- [WdRemoteCopy](https://docs.xbox.com/reference/remoting/functions/wdremotecopy.md)
- [XBOX PC Remote Iteration API](https://docs.xbox.com/reference/remoting/remoteiteration_members.md)
- [WdCopyOptions](https://docs.xbox.com/reference/remoting/structs/wdcopyoptions.md)
- [WdDeleteSearchOptions](https://docs.xbox.com/reference/remoting/structs/wddeletesearchoptions.md)
- [WdDeleteRemoteFiles](https://docs.xbox.com/reference/remoting/functions/wddeleteremotefiles.md)
