This page was machine-translated. Spotted a mistake?Help improve it.
Skip to content

Bulk Rename

使用帶有索引、補零索引及原始檔名預留位置的模式範本重新命名多個檔案。回傳包含所有已重新命名檔案的 ZIP 壓縮檔。

API Endpoint

POST /api/v1/tools/image/bulk-rename

接受包含多個檔案及 JSON settings 欄位的 multipart form data。

Parameters

ParameterTypeRequiredDefaultDescription
patternstringNo"image-"帶有預留位置的命名模式(最多 1000 個字元)
startIndexnumberNo1起始索引編號

Pattern Placeholders

PlaceholderDescriptionExample
startIndex 開始的序號123
補零的序號010203
不含副檔名的原始檔名photoIMG_001

原始檔案副檔名一律會保留。

Example Request

bash
curl -X POST http://localhost:1349/api/v1/tools/image/bulk-rename \
  -H "Authorization: Bearer si_your-api-key" \
  -F "[email protected]" \
  -F "[email protected]" \
  -F "[email protected]" \
  -F 'settings={"pattern": "vacation-{{padded}}", "startIndex": 1}'

這會產生:vacation-1.jpgvacation-2.jpgvacation-3.jpg

使用原始檔名:

bash
curl -X POST http://localhost:1349/api/v1/tools/image/bulk-rename \
  -H "Authorization: Bearer si_your-api-key" \
  -F "file=@IMG_001.jpg" \
  -F "file=@IMG_002.jpg" \
  -F 'settings={"pattern": "2024-trip-{{original}}-{{index}}"}'

這會產生:2024-trip-IMG_001-1.jpg2024-trip-IMG_002-2.jpg

Example Response

回應是直接串流的 ZIP 檔案(而非 JSON 回應)。回應標頭為:

Content-Type: application/zip
Content-Disposition: attachment; filename="renamed-a1b2c3d4.zip"

Notes

  • 此工具不會處理影像。它只會重新命名檔案並將其打包成 ZIP 壓縮檔。
  • 的補零寬度會根據檔案總數自動決定(例如 100 個檔案會使用 3 位數補零:001002 等)。
  • 檔案副檔名會從原始檔名保留。
  • 檔名會經過清理以移除不安全的字元。
  • 至少必須提供一個檔案。