> ## 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::CopyFiles 方法

> IXtfFileIOClient::CopyFiles 方法

# IXtfFileIOClient::CopyFiles 方法

在開發主機上的兩個位置之間複製檔案，並傳回作業的相關資訊。

<a id="syntaxSection" />

## 語法

```cpp theme={null}
public:
HRESULT CopyFiles(
         LPCWSTR pszSearchPattern,
         DWORD dwIncludeAttributes,
         DWORD dwExcludeAttributes,
         DWORD dwRecursionLevels,
         LPCWSTR pszDstFileName,
         DWORD dwFlags,
         IXtfCopyFileCallback *pCallback
)  
```

<a id="parametersSection" />

### 參數

*pszSearchPattern*\
類型：LPCWSTR

指向搜尋模式的指標，此模式定義要複製之來源檔案的檔案名稱。此參數接受萬用字元，以比對符合所指定模式的字串。

*dwIncludeAttributes*\
類型：DWORD

要納入複製作業之檔案屬性的位元 OR 組合。如需可能的屬性清單，請參閱[檔案屬性常數](https://msdn.microsoft.com/library/windows/desktop/gg258117\(v=vs.85\).aspx)。

*dwExcludeAttributes*\
類型：DWORD

要從複製作業中排除之檔案屬性的位元 OR 組合。如需可能的屬性清單，請參閱[檔案屬性常數](https://msdn.microsoft.com/library/windows/desktop/gg258117\(v=vs.85\).aspx)。

*dwRecursionLevels*\
類型：DWORD

複製作業要遞迴的目錄層級數目，或指定 -1 以涵蓋目錄樹狀結構的所有層級。

*pszDstFileName*\
類型：LPCWSTR

指向要複製到之目標檔案的檔案名稱的指標。

*dwFlags*\
類型：DWORD

指定如何複製檔案的旗標。這是下表所列巨集的位元 OR 組合。

| 值 | 巨集 | 描述 |
| - | - | - |
| 0x80000000 | XTFCOPYFILE\_DEFER | 延遲檔案複製。 |

*pCallback*\
類型：IXtfCopyFileCallback\*

指向 [IXtfCopyFileCallback](/zh-TW/reference/tools/xtf/xtffileio/classes/IXtfCopyFileCallback/ixtfcopyfilecallback-xtffileio-xbox-microsoft-t) 回呼的指標，當複製狀態變更時就會呼叫此回呼。

<a id="retvalSection" />

### 傳回值

類型：HRESULT

如果成功，則傳回 `S_OK`；否則傳回 HRESULT 錯誤碼。

<a id="remarksSection" />

## 備註

**IXtfFileIOClient::CopyFiles** 會啟動將一或多個檔案從 XBOX 主機上的一個位置複製到另一個位置的程序。若要追蹤檔案複製命令的進度，請使用 [IXtfCopyFileCallback](/zh-TW/reference/tools/xtf/xtffileio/classes/IXtfCopyFileCallback/ixtfcopyfilecallback-xtffileio-xbox-microsoft-t) 的執行個體來定義回呼函式。`IXtfCopyFileCallback` 包含在檔案複製作業開始時、有進度時，以及最後完成後所呼叫的回呼函式。\
使用萬用字元複製多個檔案時，*pszDstFileName* 參數會被視為目錄，所有複製的檔案都會放在該目錄中。如果該目錄不存在，則會在複製檔案之前建立它。

*dwIncludeAttributes* 和 *dwExcludeAttributes* 參數可作為篩選條件，指出要複製哪些檔案。這些參數並非用來篩選複製檔案時要複製哪些檔案屬性。

<a id="requirementsSection" />

## 需求

**標頭：** xtffileio.h

**程式庫：** xtffileio.lib

**支援的平台：** Windows (適用於 XBOX 主機工具)

<a id="seealsoSection" />

## 另請參閱

[IXtfFileIOClient 介面](/zh-TW/reference/tools/xtf/xtffileio/classes/IXtfFileIOClient/ixtffileioclient-xtffileio-xbox-microsoft-t)\
[XtfFileIO](/zh-TW/reference/tools/xtf/xtffileio/xtffileio-xbox-microsoft-n)


## Related topics

- [IXtfBatchFileIOClient::CopyFiles Method](/zh-CN/reference/tools/xtf/xtffileio/classes/IXtfBatchFileIOClient/methods/copyfiles-ixtfbatchfileioclient-xtffileio-xbox-microsoft-m.md)
- [IXtfCopyFileCallback::OnStartFileCopy Method](/zh-CN/reference/tools/xtf/xtffileio/classes/IXtfCopyFileCallback/methods/onstartfilecopy-ixtfcopyfilecallback-xtffileio-xbox-microsoft-m.md)
- [IXtfCopyFileCallback::OnFileCopyProgress Method](/zh-CN/reference/tools/xtf/xtffileio/classes/IXtfCopyFileCallback/methods/onfilecopyprogress-ixtfcopyfilecallback-xtffileio-xbox-microsoft-m.md)
- [IXtfFileIOClient::CopyFiles Method](/zh-CN/reference/tools/xtf/xtffileio/classes/IXtfFileIOClient/methods/copyfiles-ixtffileioclient-xtffileio-xbox-microsoft-m.md)
- [IXtfFileIOClient::CopyFiles (método)](/es/reference/tools/xtf/xtffileio/classes/IXtfFileIOClient/methods/copyfiles-ixtffileioclient-xtffileio-xbox-microsoft-m.md)
