> 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/action-shi-yong-zhi-nan/file-and-folder/delete-file.md).

# Delete file

根据文件路径删除文件。

Delete file 是用于根据指定路径将文件从计算机硬盘中完全删除的动作。

🎥 查看更多指导视频：[点击这里](https://youtu.be/EH7olDLAb9c)。

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

#### 配置参数：

* File Path：需要删除的文件在计算机上的绝对路径（例如：`D:\data\temp_cookie.txt`）。

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

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

* 配置方式：
  * 在脚本末尾，调用 Delete file 动作。
  * File Path：填写已使用的临时文件路径，例如：`D:\render\temp_video.mp4`。
* 结果：系统将彻底删除 D 盘目录下的 `temp_video.mp4` 文件。您的工作目录将始终保持整洁，计算机也不会在自动化流程长期运行数天后出现硬盘空间被占满的情况。

<figure><img src="https://1806980278-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FiDNNiVZHPKSIcyshmOTB%2Fuploads%2Fgit-blob-5c915310157392c3879e083c5700350ee1a7478b%2Fff-04.png?alt=media" alt=""><figcaption></figcaption></figure>


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.gpmautomate.com/automate-zh/action-shi-yong-zhi-nan/file-and-folder/delete-file.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
