> For the complete documentation index, see [llms.txt](https://ayakaleaf-pro.ayaka.space/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ayakaleaf-pro.ayaka.space/on-premises/zh-cn/wei-hu/data-and-backups/exporting-projects.md).

# 导出项目

在 Server Pro 和社区版中 `5.4.0` 我们包含了一个脚本，使管理员可以导出所有用户项目（包括仍可见于 **已删除** 和 **废纸篓** 中的文件夹）到磁盘上的一个目录。

{% hint style="info" %}
运行此脚本的输出与从用户项目控制面板手动下载所有项目的 Zip 文件相同。脚本会在开始下载前刷新任何待处理的更改，以确保导出包含项目的最新版本。
{% endhint %}

### 限制

导出脚本有以下限制：

* 不会导出任何项目设置，例如 TeX Live 镜像名称或编译器。这些必须在项目上传到用户账户时设置。
* 导出的项目不包含任何版本历史。
* 不会保留任何协作者信息。项目需要重新共享。如果使用链接共享，查看和编辑链接将被重新生成（它们不会与之前相同）。
* 任何评论和跟踪更改信息都不会被导出。
* 项目聊天历史不会被导出。

{% hint style="danger" %}
此脚本 **不** 并非旨在替代完整的系统备份。为确保你在灾难恢复场景中能够恢复实例，我们 **强烈** 建议进行 [一致性备份](https://docs.overleaf.com/on-premises/maintenance/#performing-a-consistent-backup).
{% endhint %}

### **标志**

| 名称             | 描述                                                           |
| -------------- | ------------------------------------------------------------ |
| `--help`       | 显示帮助                                                         |
| `--user-id`    | 用户 ID（必需，除非使用 `--export-all` 或 `--project-id`)               |
| `--project-id` | 导出单个项目（**不能** 与 `--user-id` 或 `--export-all`)                |
| `--list`       | 列出用户的项目（**不能** 与 `--output`)                                 |
| `--output`     | 输出 zip 文件（用于单个导出操作）                                          |
| `--export-all` | 导出所有用户的项目（需要 `--output-dir`)                                 |
| `--output-dir` | 用于存储所有用户导出文件的目录                                              |
| `--log-level`  | 支持的日志级别有： `trace`\|`debug`\|`info`\|`warn`\|`error`\|`fatal` |

### **用法**

使用以下命令导出所有用户的项目：

{% code overflow="wrap" %}

```bash
# Overleaf Toolkit 用户
$ bin/docker-compose exec sharelatex /bin/bash -ce "cd /overleaf/services/web && node modules/server-ce-scripts/scripts/export-user-projects.mjs --export-all --output-dir=/var/lib/overleaf/data/exports"

# 旧版 docker-compose.yml 用户
docker exec sharelatex /bin/bash -ce "cd /overleaf/services/web && node modules/server-ce-scripts/scripts/export-user-projects.mjs --export-all --output-dir=/var/lib/overleaf/data/exports"
```

{% endcode %}

{% hint style="info" %}
如果你运行的是 Server Pro 或 Community Editition <= 3.5.13，则需要将上面的示例更新为使用 **`export-legacy-user-projects.js`** 脚本。
{% endhint %}

### **完成**

导出完成后，你可以通过宿主机上绑定挂载到 **/var/lib/overleaf** 的目录访问这些文件， **在你的** docker-compose.yml `文件中，或者在` OVERLEAF\_DATA\_PATH **config/overleaf.rc** 环境变量中，如果你使用的是 Toolkit。

{% hint style="info" %}
Overleaf 当前允许项目名称重复。如果用户的项目包含重复项，这些项目仍会被添加到用户的 Zip 导出中，但在解压时，只会保留一个版本。在 Linux 上， `unzip -B` 会将同名文件写为备份文件，而不是覆盖它们。
{% endhint %}


---

# 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://ayakaleaf-pro.ayaka.space/on-premises/zh-cn/wei-hu/data-and-backups/exporting-projects.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.
