> For the complete documentation index, see [llms.txt](https://docs.gpmautomate.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.gpmautomate.com/automate-zh/cao-zuo-zhi-nan/file-and-folder/copy-file.md).

# 复制文件

复制文件是将一个文件从计算机硬盘的一个位置复制到另一个位置的操作。此操作将在目标位置创建一个全新的副本，并保持原始文件在初始位置不变。

#### 配置参数：

* 源文件：需要复制的源文件的绝对路径（例如：`D:\data\template.xlsx`）。
* 目标文件：复制到的目标文件的绝对路径（例如：`D:\backup\report_2026.xlsx`）。

#### 实际示例：在写入数据之前自动复制Excel模板文件

在进行数据爬虫（Data Crawler）或填写报告时，您通常会有一个已经格式化好标题列的Excel模板文件（`template.xlsx`）。您不希望脚本直接覆盖新数据以损坏此模板文件。解决方案是每次运行脚本时，系统会自动复制一个新文件以供使用：

* 配置方式：
  * 源文件：填写模板文件的路径：`D:\GPM\template.xlsx`
  * 目标文件：填写将用于写入数据的新文件路径：`D:\GPM\data_output.xlsx`
* 结果：系统将获取文件`template.xlsx`，创建一个精确的副本，并命名为`data_output.xlsx`，放置在指定目录。脚本后续的操作（如 *写入Excel文件*）将仅与此`data_output.xlsx`文件交互并写入数据，确保您的模板文件始终安全且干净，以便于后续运行。


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.gpmautomate.com/automate-zh/cao-zuo-zhi-nan/file-and-folder/copy-file.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
