> For the complete documentation index, see [llms.txt](https://overleaf-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://overleaf-pro.ayaka.space/on-premises/zh-tw/wei-hu/data-and-backups/exporting-projects.md).

# 匯出專案

在 Server Pro 與 Community Edition 中 `5.4.0` 我們已包含一個腳本，可讓管理員匯出所有使用者專案（包括那些仍可在 **已刪除** 以及 **垃圾桶** 資料夾）到磁碟上的某個目錄。

{% hint style="info" %}
執行此腳本的輸出與手動從使用者的專案儀表板下載所有專案的 Zip 檔案相同。腳本會在開始下載前清除任何待處理的變更，以確保匯出內容包含專案的最新版本。
{% endhint %}

### 限制

匯出腳本有以下限制：

* 不會匯出任何專案設定，例如 TeX Live 映像名稱或編譯器。這些必須在專案上傳到使用者帳戶時設定。
* 匯出的專案不包含任何版本歷程。
* 不會保留任何協作者資訊。專案需要重新分享。若使用連結分享，檢視與編輯連結將會重新產生（它們不會與之前相同）。
* 任何留言和追蹤變更資訊都不會匯出。
* 專案聊天室歷史不會匯出。

{% hint style="danger" %}
此腳本是 **不** 設計來取代完整的系統備份。為了確保你在災難復原情境中能夠還原你的執行個體，我們 **強烈地** 建議採取 [一致性備份](https://docs.overleaf.com/on-premises/maintenance/data-and-backups/..#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://overleaf-pro.ayaka.space/on-premises/zh-tw/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.
