> 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/delete-file.md).

# 删除文件

删除文件是指根据指定路径从计算机硬盘中完全删除一个文件的操作。

> ⚠️ 重要提示：通过此操作删除的文件将永久消失，不会出现在Windows的回收站中。因此，在执行之前，请确保路径正确，以避免误删重要数据。

#### 配置参数：

* 文件路径：指向需要删除的文件的绝对路径（例如：`D:\data\temp_cookie.txt`）。

#### 实际示例：在脚本结束后自动清理临时文件

在运行一些脚本时，例如从网上下载视频以重新上传到其他频道，或将临时数据导出到文本文件以处理字符串。在完成工作后（视频已上传，数据已同步到Google Sheet），您需要删除这些中间文件，以避免占满计算机的存储空间。

* 配置方法：
  * 在脚本的末尾，调用删除文件的操作。
  * 文件路径：填写已使用的临时文件的路径，例如：`D:\render\temp_video.mp4`。
* 结果：系统将清除D盘目录下的`temp_video.mp4`文件。您的工作目录将始终保持整洁，计算机在多天的自动流运行后不会出现硬盘满的情况。


---

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