> 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-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/#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 %}

### **完成**

匯出完成後，您可以透過主機上以 bind mount 掛載至 **/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-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.
