du command is used to list the statistical information of files per storage type under a bucket or a folder. The statistical information includes the total files of different storage types and the total size of the file per type.cos:HeadBucket, cos:GetBucket. cos:HeadBucket, cos:GetBucketVersioning, cos:GetBucketObjectVersions. ./coscli du cos://<bucket-name>[/prefix/] [flag]
du includes the following parameters:Parameter Format | Description | Example |
cos://<bucket-name> | Specifies the target bucket, which is accessible by using the bucket alias or bucket name configured in the configuration file as detailed in Download and Installation Configuration. If you use the bucket name for access, you also need to include the endpoint flag. | Access with the bucket alias: cos://example-alias Access with the bucket name: cos://examplebucket-1250000000 |
/prefix/ | Specifies a directory (optional). | /picture/ |
du includes the following optional flags:Flag Abbreviation | Flag Name | Description |
-h | --help | Views the usage of this command. |
None | --include | Includes specific objects. |
None | --exclude | Excludes specific objects. |
None | --all-versions | All version data of the statistical object is only available after version control is enabled for the bucket. The statistical information will include the count of DeleteMarkers. |
--include and --exclude support standard regular expression syntax, so you can use them to filter out objects that meet specific criteria.zsh, you may need to enclose the pattern string with double quotation marks../coscli du cos://bucket1/picture/ --include ".*\\.mp4$"
bucket1 bucket./coscli du cos://bucket1
STORAGE CLASS | OBJECTS COUNT | TOTAL SIZE--------------------------+---------------+-------------STANDARD | 2 | 164 BSTANDARD_IA | 0 | 0 BINTELLIGENT_TIERING | 0 | 0 BARCHIVE | 0 | 0 BDEEP_ARCHIVE | 0 | 0 BMAZ_STANDARD | 0 | 0 BMAZ_STANDARD_IA | 0 | 0 BMAZ_INTELLIGENT_TIERING | 0 | 0 BMAZ_ARCHIVE | 0 | 0 B--------------------------+---------------+-------------INFO[2022-12-14 17:35:41] Total Objects Count: 2INFO[2022-12-14 17:35:41] Total Objects Size: 164 B
picture directory in the bucket1 bucket./coscli du cos://bucket1/picture/
picture directory in the bucket1 bucket./coscli du cos://bucket1/picture/ --include ".*\\.mp4$"
picture directory in the bucket1 bucket./coscli du cos://bucket1/picture/ --exclude ".*\\.md$"
./coscli du cos://bucket1 --all-versions
STORAGE CLASS | OBJECTS COUNT | TOTAL SIZE--------------------------+---------------+-------------STANDARD | 545 | 1.14 MBSTANDARD_IA | 0 | 0 BINTELLIGENT_TIERING | 0 | 0 BARCHIVE | 0 | 0 BDEEP_ARCHIVE | 13 | 11.74 KBMAZ_STANDARD | 0 | 0 BMAZ_STANDARD_IA | 0 | 0 BMAZ_INTELLIGENT_TIERING | 0 | 0 BMAZ_ARCHIVE | 0 | 0 B--------------------------+---------------+-------------INFO[2025-02-25 17:36:36] Total Objects Count: 558INFO[2025-02-25 17:36:36] Total Objects Size: 1.15 MBINFO[2025-02-25 17:36:36] Total DeleteMarker Count: 501
Feedback