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

# IXtfFileIOClient::RemoveDirectory Method

> IXtfFileIOClient::RemoveDirectory Method

# IXtfFileIOClient::RemoveDirectory Method

Deletes the specified directory from the development console.

<a id="syntaxSection" />

## Syntax

```cpp theme={null}
public:
HRESULT RemoveDirectory(
         LPCWSTR pszDirectory,
         DWORD dwFlags,
         IXtfFindFileCallback *pCallback
)  
```

<a id="parametersSection" />

### Parameters

*pszDirectory*\
Type: LPCWSTR

Pointer to the directory path to the directory to delete from the development console.

*dwFlags*\
Type: DWORD

Flags that specify how to delete the directory. This is a bitwise-OR combination of the macros listed in the following table.

| Value      | Macro                     | Description                                                                                     |
| ---------- | ------------------------- | ----------------------------------------------------------------------------------------------- |
| 0x1        | XTFREMOVEDIRECTORY\_FORCE | Forces the directory deletion to occur, even if the directory contains files or subdirectories. |
| 0x80000000 | XTFDELETEFILE\_DEFER      | Defers the directory deletion.                                                                  |

*pCallback*\
Type: IXtfFindFileCallback\*

Pointer to the [IXtfFindFileCallback](/reference/tools/xtf/xtffileio/classes/IXtfFindFileCallback/ixtffindfilecallback-xtffileio-xbox-microsoft-t) callback to call when a directory to delete is found.

<a id="retvalSection" />

### Return value

Type: HRESULT

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

<a id="remarksSection" />

## Remarks

This function removes a directory on the development console. If an error occurs, this function returns an HRESULT error code. For more information about HRESULT error codes specific to XBOX Tools Framework (XTF) API, see [XTF transport errors (NDA topic)](/tools/tools-console/commandlinetools/xtf-transport-errors).

If XTFREMOVEDIRECTORY\_FORCE is specified and the directory to be removed contains files or subdirectories, the [IXtfFindFileCallback::OnFoundFile](/reference/tools/xtf/xtffileio/classes/IXtfFindFileCallback/methods/onfoundfile-ixtffindfilecallback-xtffileio-xbox-microsoft-m) callback function is invoked for each file and subdirectory in the directory to be removed. Information for each file and subdirectory in the directory is passed to the callback function, and that information can be used to track and display progress information.

<a id="requirementsSection" />

## Requirements

**Header:** xtffileio.h

**Library:** xtffileio.lib

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

<a id="seealsoSection" />

## See also

[IXtfFileIOClient::CreateDirectory](/reference/tools/xtf/xtffileio/classes/IXtfFileIOClient/methods/createdirectory-ixtffileioclient-xtffileio-xbox-microsoft-m)\
[IXtfFileIOClient Interface](/reference/tools/xtf/xtffileio/classes/IXtfFileIOClient/ixtffileioclient-xtffileio-xbox-microsoft-t)\
[XtfFileIO](/reference/tools/xtf/xtffileio/xtffileio-xbox-microsoft-n)


## Related topics

- [IXtfFileIOClient::CreateDirectory Method](/reference/tools/xtf/xtffileio/classes/IXtfFileIOClient/methods/createdirectory-ixtffileioclient-xtffileio-xbox-microsoft-m.md)
- [IXtfFileIOClient::SetFileAttributes Method](/reference/tools/xtf/xtffileio/classes/IXtfFileIOClient/methods/setfileattributes-ixtffileioclient-xtffileio-xbox-microsoft-m.md)
- [IXtfFileIOClient::CopyFiles Method](/reference/tools/xtf/xtffileio/classes/IXtfFileIOClient/methods/copyfiles-ixtffileioclient-xtffileio-xbox-microsoft-m.md)
- [IXtfFileIOClient::FindFiles Method](/reference/tools/xtf/xtffileio/classes/IXtfFileIOClient/methods/findfiles-ixtffileioclient-xtffileio-xbox-microsoft-m.md)
- [IXtfFileIOClient::DeleteFiles Method](/reference/tools/xtf/xtffileio/classes/IXtfFileIOClient/methods/deletefiles-ixtffileioclient-xtffileio-xbox-microsoft-m.md)
