Counts the number of directories (folders) inside a Huawei Cloud OBS (Object Storage Service) bucket and returns ONLY the numeric count. Supports counting the immediate subdirectories under the bucket (or a given prefix) as well as all nested directories recursively. Uses the KooCLI obsutil-backed `hcloud OBS ls -d` command (primary) or the huaweicloudsdkobs Python SDK (fallback). Read-only — never creates, modifies or deletes any resource. Use this skill whenever the user wants to know how many directories/folders an OBS bucket contains, e.g. for inventory, capacity review or structure checks. Triggers include: "count OBS directories", "OBS directory count", "number of directories in bucket", "OBS folder count", "how many folders in bucket", "OBS目录数量", "查询OBS目录数量", "OBS目录数", "桶目录数量", "目录数量", "文件夹数量", "统计目录", "目录统计".
记忆
huawei-cloud-obs-list-folders
试用Lists the Huawei Cloud OBS (Object Storage Service) buckets of the current tenant and returns the FOLDER names inside a bucket — both the top-level folders of a bucket and the sub-folders under a given prefix. Uses the KooCLI obsutil-backed command `hcloud OBS ls` (primary, parses the "Folder list" section of obsutil output) or the huaweicloudsdkobs Python SDK (fallback, ListObjects with delimiter=/). Read-only — never creates, modifies or deletes any bucket, folder or object. Use this skill whenever the user wants to see which OBS buckets exist or which folders a bucket (or a folder inside it) contains, e.g. for daily inspection, inventory, data organization review or troubleshooting. Triggers include: "list OBS buckets", "OBS bucket list", "list folders in bucket", "OBS folder names", "查询OBS列表", "OBS桶列表", "OBS文件夹名称", "桶里有哪些文件夹", "查询obs列表", "返回obs列表中文件夹名称", "OBS目录列表".
它能做什么
Lists the Huawei Cloud OBS (Object Storage Service) buckets of the current tenant and returns the FOLDER names inside a bucket — both the top-level folders of a bucket and the sub-folders under a given prefix. Uses the KooCLI obsutil-backed command `hcloud OBS ls` (primary, parses the "Folder list" section of obsutil output) or the huaweicloudsdkobs Python SDK (fallback, ListObjects with delimiter=/). Read-only — never creates, modifies or deletes any bucket, folder or object. Use this skill whenever the user wants to see which OBS buckets exist or which folders a bucket (or a folder inside it) contains, e.g. for daily inspection, inventory, data organization review or troubleshooting. Triggers include: "list OBS buckets", "OBS bucket list", "list folders in bucket", "OBS folder names", "查询OBS列表", "OBS桶列表", "OBS文件夹名称", "桶里有哪些文件夹", "查询obs列表", "返回obs列表中文件夹名称", "OBS目录列表".
技能文档
Huawei Cloud OBS List Folders Skill
Overview
This skill queries the Huawei Cloud OBS (Object Storage Service) of the current tenant and returns:
- The bucket list — all OBS buckets owned by the tenant.
- The folder names at the root of a bucket — top-level folders
(prefixes ending in
/). - The sub-folder names under a given folder/prefix inside a bucket.
It is a read-only inspection skill: it never creates, modifies or deletes buckets, folders or objects.
Architecture:
Agent → hcloud CLI (KooCLI OBS / obsutil, primary) → Huawei Cloud OBS API
↘ huaweicloudsdkobs Python SDK (fallback) ↗
API paths (verified from huaweicloudsdkobs v1 SDK ObsClient _http_info):
| Operation | Method | API Path |
|---|---|---|
| List buckets | GET | / (ListBuckets) |
| List objects / folders in a bucket | GET | /{bucket} (ListObjects, delimiter=/) |
Execution-quality reporting: every invocation of
scripts/list_obs_folders.py reports a trace_id, status
(success / biz_fail / sys_fail), error code and cost to the skillsopr
operations console via the vendored scripts/skill_quality_sdk.py. Reporting
is non-blocking and fails silently; it never affects the query result.
Applicable Scenarios:
- Daily inspection: "which OBS buckets exist?" / "what folders are in this bucket?"
- Inventory: enumerate buckets and folder structure for data organization review
- Troubleshooting: locate the folder where a file is expected to be stored
- Cost/usage review: understand bucket layout before estimating storage usage
- Data governance: verify folder naming conventions across buckets
能力边界(Capability Boundary): 本 Skill 仅查询 OBS 桶列表与桶内文件夹名称。不创建/删除/修改桶、 文件夹或对象,不统计文件数量,也不下载/上传对象内容。 若用户询问"创建/删除桶"、"统计文件数量"、"上传/下载文件"等, 请明确告知本 Skill 不提供该能力。
Prerequisites
- hcloud CLI (KooCLI) installed and authenticated — See
references/cli-installation-guide.md. The OBS service of KooCLI is obsutil-backed:hcloud OBSmaps to obsutil commands. - Python 3.8+ with
huaweicloudsdkobspackage installed (SDK fallback only) - IAM permissions —
obs:bucket:ListAllMyBuckets(list buckets) andobs:bucket:ListBucket/obs:object:List(list objects/folders in a bucket). The system policyOBS ReadOnlyAccesscovers both. Seereferences/iam-policies.md - A region where the tenant owns OBS buckets; specify it with
--cli-region(buckets are global, but the region determines the obsutil endpoint)
Workflow
- Identify the intent — Confirm the user wants to list OBS buckets and/or folder names inside a bucket, and which bucket/prefix.
- Confirm parameters —
{region}(defaultcn-north-4) and optionally{bucket}/{prefix}. - Run the query — Use the CLI commands below (or the wrapper script).
- Present the results — Show the bucket names, and for a bucket query show the folder names one per line.
- Handle errors — If the CLI fails (credentials/permissions/network),
retry with the SDK fallback described in
references/verification-method.md.
Core Commands
KooCLI format:
hcloud --cli-region= [--params]Note: KooCLI's OBS service delegates to obsutil, so the OBS commands use obsutil syntax (
hcloud OBS ls ...) rather than a PascalCase operation.
List all OBS buckets
hcloud OBS ls
Output: one line per bucket in the form obs://.
List folders at the root of a bucket
hcloud OBS ls obs://{bucket}
Output contains a Folder list: section — the folder names are the lines
under it (e.g. obs://my-bucket/CloudTraces/). Use the wrapper script to get
just the folder names:
python3 scripts/list_obs_folders.py --bucket {bucket} --folders-only
List sub-folders under a prefix
Note: the
-dflag makes obsutil list the sub-folders inside the given folder. Without it, obsutil only echoes the folder matching the prefix itself.
hcloud OBS ls obs://{bucket}/{prefix} -d
python3 scripts/list_obs_folders.py --bucket {bucket} --prefix {prefix} --folders-only
Compact: bucket names only
hcloud OBS ls | grep '^obs://'
Wrapper script (recommended — includes quality reporting)
python3 scripts/list_obs_folders.py --region {region} --buckets-only # bucket names only
python3 scripts/list_obs_folders.py --bucket {bucket} --folders-only # folder names only
python3 scripts/list_obs_folders.py --bucket {bucket} --prefix photos # sub-folders under prefix
The wrapper tries the CLI first, falls back to the huaweicloudsdkobs SDK,
and reports execution quality to the skillsopr console. Set
SKILL_QUALITY_DISABLE=1 to disable reporting (local debugging).
Parameter Confirmation
| Parameter | Required | Description | Example |
|---|---|---|---|
{region} | No | Huawei Cloud region (default cn-north-4) | cn-north-4 |
{bucket} | Conditional | OBS bucket name (needed to list folders) | my-bucket |
{prefix} | No | Folder/prefix inside the bucket | photos |
--folders-only | No | Print only folder names (one per line) | — |
--buckets-only | No | Print only bucket names (one per line) | — |
--executor | No | cli / sdk / auto (default auto) | sdk |
KooCLI Command Format Standard
The KooCLI command format is:
hcloud --cli-region= [--key=value ...]
Note: this is a generic format template, not an executable command — replace
,, `` and the parameters with real values. For OBS, KooCLI delegates to obsutil:hcloud OBS ls [obs://bucket[/prefix]] [-s] [-d] [-limit=N].
- Service name:
OBS(starts with uppercase; the KooCLI OBS service is obsutil-backed). - Region: always pass
--cli-region=for non-OBS services; for OBS the region is configured via the obsutil endpoint (hcloud OBS config -e=obs..myhuaweicloud.com). - Simple parameters use
--key=value; obsutil options use-optionstyle (e.g.-limit=1000,-sfor brief mode,-dto list sub-folders).
Reference Documents
- IAM Policies — Least-privilege IAM permissions
- CLI Installation Guide — hcloud CLI setup and OBS/obsutil configuration
- Verification Method — How to verify the skill works
- Dataflow Diagram — Request flow diagram
- Acceptance Criteria — Acceptance test checklist
相关技能
Skill specialized for creating buckets on Huawei Cloud OBS. Use this skill when users need to create OBS buckets, set bucket properties, configure access per...
Counts the total number of files (objects) inside a Huawei Cloud OBS (Object Storage Service) bucket and returns ONLY the numeric count. Supports counting all files in a whole bucket or all files under a given prefix (folder). Zero-byte folder-marker keys (ending with '/') are excluded — only real files/objects are counted. Uses the KooCLI obsutil-backed `hcloud OBS ls ... -limit=0` command (primary, parses the "File number" line) or the huaweicloudsdkobs Python SDK (fallback, paginated ListObjects). Read-only — never creates, modifies or deletes any resource. Use this skill whenever the user wants to know how many files or objects an OBS bucket (or a folder inside it) contains, e.g. for inventory, capacity review, migration planning or compliance checks. Triggers include: "count OBS files", "OBS file count", "number of files in bucket", "how many objects in bucket", "OBS object count", "OBS文件数量", "查询OBS文件总数", "OBS文件总数", "桶里有多少个文件", "统计文件数量", "对象数量", "查询对象总数".
Upload local files or directories to Huawei Cloud OBS (Object Storage Service) buckets, list OBS buckets with capacity and object count, and schedule periodic uploads via crontab. Use this skill when the user wants to: (1) upload a local file or directory to an OBS bucket, (2) list OBS buckets and check their storage capacity and object count, (3) set up a scheduled/periodic upload task to automatically sync a local directory to an OBS bucket. Trigger: user mentions "OBS", "object storage", "bucket list", "bucket capacity", "upload to OBS", "upload file", "upload directory", "scheduled upload", "periodic upload", "sync to bucket", "对象存储", "桶列表", "桶容量", "上传文件", "上传目录", "定时上传", "OBS管理"
Queries the total storage size of Huawei Cloud OBS (Object Storage Service) buckets and returns ONLY the size value — a single number, in bytes by default. Supports querying the total size of one bucket or the combined total across all buckets under the account. Uses the KooCLI obsutil-backed `hcloud OBS ls ... -du -bf=raw` command (primary) or the huaweicloudsdkobs Python SDK (fallback). Read-only — never creates, modifies or deletes any resource. Use this skill whenever the user wants to know the total size of an OBS bucket or the overall OBS storage usage, e.g. for capacity review, cost estimation or storage planning. Triggers include: OBS total size, OBS bucket size, total storage usage, bucket capacity, OBS大小, OBS总大小, OBS容量, 桶大小, 查询OBS大小, 存储占用, OBS存储量.
Query Huawei Cloud OBS (Object Storage Service) statistics: list buckets with capacity and object counts, query extranet/intranet download traffic with month...