> For the complete documentation index, see [llms.txt](https://academy.shade.inc/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://academy.shade.inc/guides/guides-zh/zi-dong-hua/zi-dong-zheng-li-xin-shang-chuan-nei-rong.md).

# 自动整理新上传内容

文件一落地，就设置元数据、重命名，并将新上传归入正确的项目文件夹。

**结果：** 放入一个 `传入` 文件夹中的文件会被标记上项目、统一重命名，并移动到该项目的文件夹中，无需任何人手动整理。

**适用于：** 持续接收媒体文件流（相机卡、代理交付、贡献者上传）并花时间整理的团队。

**时间：** 约 20 分钟。

## 开始之前

* 构建 [你的第一个自动化](/guides/guides-zh/zi-dong-hua/ni-de-di-yi-ge-zi-dong-hua.md) 如果你还没有使用过自动化编辑器，请先。
* 先统一一个文件名约定，以项目代码开头，例如 `ACME_interview_01.mov`。本配方会从文件名开头读取项目代码。
* 添加一个 **项目** 文本字段到驱动器的元数据中。参见 [元数据和自定义字段](https://academy.shade.inc/ai-tools/custom-and-automated-metadata).
* 为每个项目创建一个目标文件夹，例如 `Projects/ACME/Footage` 和 `Projects/ACME/Stills`. **移动资产** 只会把文件移动到已存在的文件夹中，不会创建文件夹。

## 工作原理

```mermaid
flowchart LR
  T["资产上传（传入）"] --> X["转换文本：从文件名提取项目代码"]
  X --> M["更新资产元数据：项目"]
  M --> S{"如果 / 否则：资产类型"}
  S -->|video| V["将资产移动到 Projects/code/Footage"]
  S -->|image| I["将资产移动到 Projects/code/Stills"]
```

## 步骤

{% stepper %}
{% step %}

### 对上传到 Incoming 的文件触发

创建一个名为 `Sort Incoming`的新自动化。选择 **资产上传** 并将 **上传位置** 设置为 `传入`.
{% endstep %}

{% step %}

### 从文件名中提取项目代码

添加一个 **转换文本** 步骤：

* **输入文本：** 输入 `{` 并选择已上传资产的 **名称**。名称不包含文件扩展名。
* **操作：** 拆分，保留第一部分。
* **分隔符：** `_`

对于 `ACME_interview_01.mov`，该步骤会输出 `ACME`.
{% endstep %}

{% step %}

### 为文件添加项目标签

添加 **更新资产元数据**:

* **资产：** 触发器中的已上传资产。
* **要更新的字段：** 设置 **项目** 为转换文本步骤的输出。

这样，即使后来有人移动它，文件也能按项目搜索和筛选。
{% endstep %}

{% step %}

### 按文件类型路由

添加一个 **如果 / 否则** 步骤，用于检查已上传资产的 **输入**.

* 在视频分支上，添加 **移动资产** 并将 **目标文件夹** 设置为 `Projects/`，然后是转换文本输出，再然后是 `/Footage`.
* 在另一分支上，添加 **移动资产** 并将 `Projects/`，然后是转换文本输出，再然后是 `/Stills`.

类型 `{` 在 **目标文件夹** 字段中插入项目代码，放在路径的固定部分之间。
{% endstep %}

{% step %}

### 可选：重命名为你的内部风格

在移动之前，添加 **重命名资产** 如果你想要统一的名称，例如项目代码、拍摄日期和原始名称。原始文件扩展名会自动保留，所以不要输入它。
{% endstep %}

{% step %}

### 保存、启用并测试

点击 **保存**，然后 **启用**。上传一个使用真实项目代码命名的测试文件，并检查它是否最终出现在正确的文件夹中，且 **项目** 已填写。若没有，请打开 **运行** 查看是哪一步失败以及原因。
{% endstep %}
{% endstepper %}

{% hint style="warning" %}
自动化会以创建者的权限运行。如果创建者失去了对目标文件夹的编辑权限， **移动资产** 步骤就会失败。
{% endhint %}

## 变体

* **未知的项目代码：** 在移动之前，添加 **查找记录** ，在一个 **项目** 自定义对象中查找该代码，并将没有匹配项的文件发送到 `Incoming/Unsorted` 文件夹。参见 [将项目和客户建模为自定义对象](/guides/guides-zh/zi-ding-yi-dui-xiang-he-yuan-shu-ju/jiang-xiang-mu-he-ke-hu-jian-mo-wei-zi-ding-yi-dui-xiang.md).
* **让 AI 标记内容：** 开启 **使用 AI 自动填充** 针对拍摄类型或标签等字段，让它们根据图片或视频本身自动填入。为此你不需要自动化步骤。
* **超过两种文件类型：** 使用 **切换** 而不是 **如果 / 否则** ，将视频、音频、图片和文档发送到不同的文件夹。

## 相关文章

* [你的第一个自动化](/guides/guides-zh/zi-dong-hua/ni-de-di-yi-ge-zi-dong-hua.md)
* [设计可扩展的元数据架构](/guides/guides-zh/zi-ding-yi-dui-xiang-he-yuan-shu-ju/she-ji-ke-kuo-zhan-de-yuan-shu-ju-jia-gou.md)
* [为每个新项目创建一个文件夹](/guides/guides-zh/zi-ding-yi-dui-xiang-he-yuan-shu-ju/wei-mei-ge-xin-xiang-mu-chuang-jian-yi-ge-wen-jian-jia.md)


---

# 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://academy.shade.inc/guides/guides-zh/zi-dong-hua/zi-dong-zheng-li-xin-shang-chuan-nei-rong.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.
