Directory size and file count
zspace_duGet the size, file count and directory count of one NAS directory.
Instructions
Get the size, file count and directory count of one NAS directory.
Returns {path, bytes, files, dirs, state, complete, source, categories}.
Always check complete before reporting the numbers. The server-side
statistic is instant and exact for small-to-medium trees, but on large ones
the NAS returns state="running" with a partial snapshot that never
converges -- measured on a 1.175 TiB / 448k-file folder, fourteen
consecutive calls all reported ~0.35 TiB with the file count jittering
between 27k and 30k. There is no poll endpoint that works, so when
complete is false either pass walk=true or tell the user the figure is a
lower bound. Never present a partial number as the answer.
walk=true traverses via /v2/file/list at roughly one request per directory; a 448k-file tree needs ~93k requests and ~12 minutes. Read-only.
Do not cross-check this against a du run on an SMB mount and assume one of
them is broken. The mount exposes directories the file API cannot see at all
-- notably "@Recycle", the same recycle bin that zspace_recycle_list reads
as "/.recycle/my" -- so a mount-side count includes recycled data this tool
correctly excludes. Mount-side scans must skip "@Recycle" (and
".zspace_trash"); counting it inflates totals without raising any error.
For whole-pool accounting use zspace_usage; to list individual large files use zspace_bigfiles.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | Absolute directory path, e.g. /sata11/my/data/影视 | |
| walk | No | Force an exact client-side traversal (slow, but the only reliable option for very large trees) |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||