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

# WdDeleteRemoteFiles

> 원격 디바이스에서 파일과 디렉터리를 최선의 방식으로 삭제하는 WdDeleteRemoteFiles의 구문, 매개 변수 및 설명에 대한 참조입니다.

# WdDeleteRemoteFiles

원격 디바이스에서 파일과 디렉터리를 최선의 방식(best-effort)으로 삭제합니다.

**도입된 릴리스:** [RIT 0.0.13-preview](/ko/reference/remoting/release-versions#release-versions).

## 구문

```cpp theme={null}
HRESULT WdDeleteRemoteFiles(  
         _In_z_ const char* remoteDevice,  
         _In_z_ const char* remoteFolderPath,  
         _In_opt_ const WdDeleteOptions* deleteOptions,  
         _In_opt_ const WdDeleteSearchOptions* searchOptions,  
         _In_opt_ const WdDeleteStatusCallbacks* statusCallbacks,  
         _In_opt_ WdCancellationHandle cancellationHandle  
);  
```

### 매개 변수

`_In_z_ remoteDevice`\
형식: **const char\***

원격 디바이스의 주소 또는 이름(UTF-8)입니다(예: `"192.168.1.100"` 또는 `"MyDevKit"`).

`_In_z_ remoteFolderPath`\
형식: **const char\***

삭제할 원격 디바이스의 경로(UTF-8)입니다. 폴더 경로일 수 있으며 이 경우 해당 폴더의 콘텐츠가 삭제되고, 단일 파일 경로일 수도 있으며 이 경우 해당 파일만 삭제됩니다. `remoteFolderPath`가 절대 경로인 경우 [WdDeleteOptions](/ko/reference/remoting/structs/wddeleteoptions)의 `commonRootAlias`는 무시됩니다.

`_In_opt_ deleteOptions`\
형식: **const [WdDeleteOptions](/ko/reference/remoting/structs/wddeleteoptions)\***

선택 사항입니다. 경로 확인에 사용되는 공통 루트 별칭과 루트 폴더 자체의 제거를 시도할지 여부를 지정합니다. `remoteFolderPath`가 상대 경로일 때 기본 공통 루트 위치를 사용하고, 루트 폴더는 그대로 두어 해당 콘텐츠만 삭제하려면 `nullptr`을 전달합니다. `remoteFolderPath`가 단일 파일로 확인되면 `deleteRootFolder`는 무시됩니다.

`_In_opt_ searchOptions`\
형식: **const [WdDeleteSearchOptions](/ko/reference/remoting/structs/wddeletesearchoptions)\***

선택 사항입니다. 삭제할 파일과 디렉터리를 선택하는 포함/제외 패턴 및 특성 필터를 지정합니다. 모든 항목을 포함하려면 `nullptr`을 전달합니다. 이 옵션은 `remoteFolderPath`가 폴더로 확인되는 경우에만 적용되며, 단일 파일로 확인되는 경우에는 무시됩니다.

`_In_opt_ statusCallbacks`\
형식: **const [WdDeleteStatusCallbacks](/ko/reference/remoting/structs/wddeletestatuscallbacks)\***

현재 무시됩니다. `nullptr`을 전달합니다. 진행률 또는 오류 콜백은 호출되지 않습니다.

`_In_opt_ cancellationHandle`\
형식: **[WdCancellationHandle](/ko/reference/remoting/structs/wdcancellationhandle)**

선택 사항입니다. [WdCreateCancellationHandle](/ko/reference/remoting/functions/wdcreatecancellationhandle)로 생성된 취소 핸들로, 별도의 스레드에서 [WdCancelRemoteDelete](/ko/reference/remoting/functions/wdcancelremotedelete)에 전달하여 클라이언트 대기를 중지할 수 있습니다. 취소가 필요하지 않으면 `nullptr`을 전달합니다.

### 반환 값

형식: **HRESULT**

엔드포인트가 성공을 보고하거나 클라이언트가 취소를 감지하면 `S_OK`를 반환하고, 그렇지 않으면 오류 코드를 반환합니다. `S_OK`가 선택된 모든 항목이 삭제되었음을 보장하지는 않습니다. 근본 원인 및 문제 해결 지침을 포함한 API별 오류 코드 목록은 [XBOX PC Remote Iteration API 오류 코드](/ko/reference/remoting/error-codes)를 참조하세요.

## 설명

`WdDeleteRemoteFiles`는 동기식 블로킹 호출입니다. 엔드포인트 결과, 오류 또는 [WdCancelRemoteDelete](/ko/reference/remoting/functions/wdcancelremotedelete)를 통한 취소 감지를 기다립니다. 삭제는 최선의 방식으로 수행됩니다. 항목별 결과는 반환되지 않으며, 파일 삭제 실패는 엔드포인트 로그에만 보고됩니다.

취소를 사용하도록 설정하려면 `WdDeleteRemoteFiles`를 호출하기 전에 [WdCreateCancellationHandle](/ko/reference/remoting/functions/wdcreatecancellationhandle)을 사용하여 [WdCancellationHandle](/ko/reference/remoting/structs/wdcancellationhandle)을 생성한 다음, 별도의 스레드에서 이를 [WdCancelRemoteDelete](/ko/reference/remoting/functions/wdcancelremotedelete)에 전달합니다. `WdDeleteRemoteFiles`가 반환된 후 [WdCloseCancellationHandle](/ko/reference/remoting/functions/wdclosecancellationhandle)로 핸들을 닫습니다.

취소는 클라이언트 대기를 중지할 뿐, 엔드포인트에서 이미 시작된 삭제는 중지하지 않습니다. 취소가 감지되면 호출은 엔드포인트 완료를 확인하지 않은 채 `S_OK`를 반환합니다.

기본적으로 `remoteFolderPath`의 콘텐츠만 삭제되고 폴더 자체는 그대로 유지됩니다. 콘텐츠가 삭제된 후 폴더도 제거를 시도하려면 [WdDeleteOptions](/ko/reference/remoting/structs/wddeleteoptions)의 `deleteRootFolder`를 `true`로 설정합니다. 제거는 최선의 방식으로 수행되며 폴더가 비어 있는 경우에만 시도됩니다. 필터링된 삭제로 항목이 남아 있으면 폴더는 유지됩니다.

`deleteRootFolder`와 관계없이, 이 작업은 디렉터리 필터를 통과하는 빈 하위 디렉터리(이미 비어 있던 디렉터리 포함)의 제거도 시도합니다.

`remoteFolderPath`가 절대 경로인 경우 [WdDeleteOptions](/ko/reference/remoting/structs/wddeleteoptions)의 `commonRootAlias`는 무시됩니다. `remoteFolderPath`가 상대 경로인 경우 `commonRootAlias`가 지정되지 않으면 기본 공통 루트 위치가 사용됩니다.

> \[!WARNING]
> 삭제 작업은 `remoteFolderPath` 아래의 디렉터리 정션과 디렉터리 심볼릭 링크를 따라가 해당 디렉터리 외부의 일치하는 파일을 삭제할 수 있습니다. 이 경우에도 작업은 `S_OK`를 반환할 수 있으며, 항목별 결과나 실행 취소 작업은 제공되지 않습니다. 루트 자체가 링크된 디렉터리가 아닌지 확인하고, `excludeDirPattern`을 사용하여 알려진 링크된 하위 디렉터리를 이름으로 제외하세요.

## 예제

### 예제 1: 배포 폴더 지우기

기본 설정을 사용하여 원격 디바이스에 있는 게임 폴더의 콘텐츠 삭제를 시도합니다. 폴더 자체는 그대로 유지됩니다. 성공적으로 반환되더라도 폴더가 비어 있음을 증명하지는 않습니다.

```cpp theme={null}
// BasicDelete.cpp
// Clears the contents of a deployment folder on a remote device.
// Build: Link against wdremoteapi.lib

#include <windows.h>
#include <stdio.h>
#include "WdRemoteIteration.h"

int main()
{
    // TODO: Replace with your remote device IP address or hostname
    const char* remoteDevice = "192.168.1.100";

    // TODO: Replace with the folder name on the remote device.
    // Relative paths resolve against the default common root.
    const char* remoteFolderPath = "MyGame";

    HRESULT hr = WdDeleteRemoteFiles(
        remoteDevice,
        remoteFolderPath,
        nullptr,    // deleteOptions — default common root, folder itself is kept
        nullptr,    // searchOptions - selects all items
        nullptr,    // statusCallbacks - currently ignored
        nullptr);   // cancellationHandle — no cancellation support

    if (SUCCEEDED(hr))
    {
        printf("Delete request completed. Some items may remain.\n");
    }
    else
    {
        printf("Delete failed: HRESULT 0x%08X\n", hr);
    }

    return hr;
}
```

### 예제 2: 필터링된 삭제

저장된 게임 데이터는 유지하면서 선택한 빌드 아티팩트의 제거를 시도합니다.

```cpp theme={null}
// FilteredDelete.cpp
// Deletes selected build artifacts.
// Build: Link against wdremoteapi.lib

#include <windows.h>
#include <stdio.h>
#include "WdRemoteIteration.h"

int main()
{
    const char* remoteDevice     = "192.168.1.100";
    const char* remoteFolderPath = "MyGame";

    // Remove executables and symbols, but keep save data
    WdDeleteSearchOptions searchOptions = {};
    searchOptions.includeFilePattern    = "*.exe;*.dll;*.pdb";
    searchOptions.excludeFilePattern    = "*.sav";
    searchOptions.excludeDirPattern     = "SaveData";
    searchOptions.includeFileAttributes = 0;  // No attribute-based include filter
    searchOptions.excludeFileAttributes = 0;  // No attribute-based exclude filter
    searchOptions.includeDirAttributes  = 0;  // No attribute-based include filter
    searchOptions.excludeDirAttributes  = 0;  // No attribute-based exclude filter

    HRESULT hr = WdDeleteRemoteFiles(
        remoteDevice,
        remoteFolderPath,
        nullptr,          // deleteOptions — defaults
        &searchOptions,
        nullptr,          // statusCallbacks - currently ignored
        nullptr);         // cancellationHandle — no cancellation support

    if (SUCCEEDED(hr))
    {
        printf("Delete request completed. Some items may remain.\n");
    }
    else
    {
        printf("Delete failed: HRESULT 0x%08X\n", hr);
    }

    return hr;
}
```

## 요구 사항

| 요구 사항 | 값 |
| - | - |
| **헤더** | WdRemoteIteration.h |
| **라이브러리** | wdremoteapi.lib |
| **지원 OS** | Windows 11 이상 |
| **지원 아키텍처** | x64, ARM64 |

## 함께 보기

* [WdCancelRemoteDelete](/ko/reference/remoting/functions/wdcancelremotedelete)
* [WdCancellationHandle](/ko/reference/remoting/structs/wdcancellationhandle)
* [WdCreateCancellationHandle](/ko/reference/remoting/functions/wdcreatecancellationhandle)
* [WdCloseCancellationHandle](/ko/reference/remoting/functions/wdclosecancellationhandle)
* [WdDeleteOptions](/ko/reference/remoting/structs/wddeleteoptions)
* [WdDeleteSearchOptions](/ko/reference/remoting/structs/wddeletesearchoptions)
* [WdDeleteStatusCallbacks](/ko/reference/remoting/structs/wddeletestatuscallbacks)
* [WdRemoteCopy](/ko/reference/remoting/functions/wdremotecopy)
* [XBOX PC Remote Iteration API 오류 코드](/ko/reference/remoting/error-codes)
* [XBOX PC Remote Iteration API](/ko/reference/remoting/remoteiteration_members)


## Related topics

- [WdDeleteFileProgressInfo](/ko/reference/remoting/structs/wddeletefileprogressinfo.md)
- [WdCancelRemoteDelete](/ko/reference/remoting/functions/wdcancelremotedelete.md)
- [WdDeleteOptions](/ko/reference/remoting/structs/wddeleteoptions.md)
- [WdDeleteOperationSummary](/ko/reference/remoting/structs/wddeleteoperationsummary.md)
- [WdDeleteProgressCallback](/ko/reference/remoting/callbacks/wddeleteprogresscallback.md)
