tencent cloud

All product documents
Cloud Object Storage
DocumentationCloud Object StorageUser ToolsCOSCLI (Beta)Common CommandsListing Contents and Statistics Under a Directory - lsdu
Listing Contents and Statistics Under a Directory - lsdu
Last updated: 2024-11-01 20:59:19
Listing Contents and Statistics Under a Directory - lsdu
Last updated: 2024-11-01 20:59:19
The lsdu command is used to obtain the contents of the current level with a specified prefix and to calculate the size and number of objects within it.

Command Syntax

./coscli lsdu cos://<bucket-name>[/prefix/] [flags]
The lsdu command 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/
The lsdu command includes the following optional flags:
Flag Abbreviation
Flag Name
Description
-h
--help
Views the usage of this command.
No
--include
Includes specific objects.
No
--exclude
Excludes specific objects.
Note
For more general options for this command (such as switching buckets or user accounts), see Common Options.

Operation Example

Obtaining the statistics under the root directory of the bucket1 bucket

./coscli lsdu cos://bucket1/
The returned information includes the names of directories or objects, the total number of objects, and the total size. Below is an example:
NAME | OBJECTS COUNT | TOTAL SIZE
---------------------+---------------+-------------
300123/ | 1 | 300.00 MB
300s/ | 1 | 100.00 MB
300u/ | 301 | 8.22 GB
activity/ | 35 | 129.08 KB
test/ | 1 | 3 B
test100/ | 20 | 20.00 GB
test5/ | 6 | 9.00 GB
testrm/ | 1 | 0 B
10GB_file | 1 | 11.72 GB
1GB_file | 1 | 1.00 GB

Obtaining the statistics under the picture directory of the bucket1 bucket

./coscli lsdu cos://bucket1/picture/
Note:
When there are many files, this command may take a long time to run. It is recommended to run it in the background.
Was this page helpful?
You can also Contact Sales or Submit a Ticket for help.
Yes
No

Feedback

Contact Us

Contact our sales team or business advisors to help your business.

Technical Support

Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

7x24 Phone Support
Hong Kong, China
+852 800 906 020 (Toll Free)
United States
+1 844 606 0804 (Toll Free)
United Kingdom
+44 808 196 4551 (Toll Free)
Canada
+1 888 605 7930 (Toll Free)
Australia
+61 1300 986 386 (Toll Free)
EdgeOne hotline
+852 300 80699
More local hotlines coming soon