> For the complete documentation index, see [llms.txt](https://docs.unitlab.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.unitlab.ai/api-sdk-cli/ja/sdks/pattern-cloud-folder-to-project.md).

# パターン：クラウドフォルダからプロジェクトへ

Unitlab Python SDK で接続済みの S3、GCS、Azure バケットから新しい記録を定期的にプロジェクトへインポートし、メディアをコピーせずにラベル付け待ちにする夜間ジョブの例です。

ロボットや車両フリートが S3、GCS、Azure に記録を書き込み、夜間ジョブで新しい記録をラベル付けのキューに入れたい場合に使います。

```python
import os
from unitlab import UnitlabClient

PREFIX = "fleet/cell-04/2026-11-21/"

client = UnitlabClient()
try:
    storage = client.cloud_storages.get(os.environ["CLOUD_STORAGE_ID"])
    project = client.projects.get(os.environ["PROJECT_ID"])

    paths = [entry.name for entry in storage.browse(prefix=PREFIX, project=project)
             if entry.type == "file" and entry.is_extension_allowed]
    if not paths:
        raise SystemExit("Nothing new")

    batch = project.import_cloud(storage, paths, fps=2.0)
    status = batch.wait(timeout=3600)
    print(f"Imported {status.completed} of {status.total}, {status.failed} failed")
finally:
    client.close()
```

プレフィックス全体をインポートするには、個別のファイルではなく末尾が `/` のフォルダパスを渡します。プレフィックスごとに 1 回インポートを実行し、Batch Queue ID をジョブログに残しておくと、再実行時にすでに届いたものを確認できます。

## 要件 <a href="#requirements" id="requirements"></a>

* アプリで作成した、バケットへの読み取り権限を持つクラウドストレージ接続。
* **Manage cloud storage** と **Manage data** の権限を持つキー。

## 関連情報 <a href="#related" id="related"></a>

[クラウドストレージ](https://docs.unitlab.ai/api-sdk-cli/ja/sdks/cloud-storage.md) · [Batch Queue と処理ステータス](https://docs.unitlab.ai/api-sdk-cli/ja/sdks/batch-queues-and-processing.md) · [CLI の自動化と終了動作](https://docs.unitlab.ai/api-sdk-cli/ja/clis/cli-automation-and-exit-behavior.md)
