> ## Documentation Index
> Fetch the complete documentation index at: https://ayakaleaf-pro.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# 匯出專案

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

<Info>
  執行此腳本的輸出結果，與從使用者的專案儀表板手動下載所有專案的 Zip 檔相同。腳本在開始下載前會先寫入所有待處理的變更，以確保匯出內容包含專案的最新版本。
</Info>

### 限制

匯出腳本有以下限制：

* 不會匯出任何專案設定，例如 TeX Live 映像檔名稱或編譯器。這些設定必須在專案上傳至使用者帳號時重新設定。
* 匯出的專案不包含任何版本歷史記錄。
* 不會保留任何協作者資訊，專案需要重新分享。若使用連結分享，檢視與編輯連結將會重新產生（與先前的連結不同）。
* 不會匯出任何註解與追蹤修訂資訊。
* 不會匯出專案聊天記錄。

<Danger>
  此腳本**並非**設計用來取代完整的系統備份。為確保您能在災難復原情境中還原執行個體，我們**強烈**建議您進行[一致性備份](https://docs.overleaf.com/on-premises/maintenance/#performing-a-consistent-backup)。
</Danger>

### **旗標**

| 名稱 | 說明 |
| - | - |
| `--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` |

### **用法**

使用以下指令匯出所有使用者的專案：

```bash wrap theme={null}
# Overleaf Toolkit users
$ 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"

# Legacy docker-compose.yml users
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"
```

<Info>
  如果您執行的是 Server Pro 或 Community Edition \<= 3.5.13，則需要將上述範例改為使用 **`export-legacy-user-projects.js`** 腳本。
</Info>

### **完成**

匯出完成後，您可以透過主機上的目錄存取這些檔案：該目錄即為 **docker-compose.yml** 檔案中綁定掛載至 <strong>/var/lib/overleaf</strong> 的目錄；若您使用 Toolkit，則為 **config/overleaf.rc** 檔案中 `OVERLEAF_DATA_PATH` 環境變數所指定的目錄。

<Info>
  Overleaf 目前允許重複的專案名稱。如果使用者有名稱重複的專案，這些專案仍會加入該使用者的 Zip 匯出檔中，但解壓縮時只會保留其中一個版本。在 Linux 上，`unzip -B` 會將同名檔案寫成備份檔，而不是直接覆寫。
</Info>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.