tencent cloud

Cloud Object Storage

Release Notes and Announcements
Release Notes
Announcements
Product Introduction
Overview
Features
Use Cases
Strengths
Concepts
Regions and Access Endpoints
Specifications and Limits
Service Regions and Service Providers
Billing
Billing Overview
Billing Method
Billable Items
Free Tier
Billing Examples
Viewing and Downloading Bill
Payment Overdue
FAQs
Getting Started
Console
Getting Started with COSBrowser
User Guide
Creating Request
Bucket
Object
Data Management
Batch Operation
Global Acceleration
Monitoring and Alarms
Operations Center
Data Processing
Content Moderation
Smart Toolbox
Data Processing Workflow
Application Integration
User Tools
Tool Overview
Installation and Configuration of Environment
COSBrowser
COSCLI (Beta)
COSCMD
COS Migration
FTP Server
Hadoop
COSDistCp
HDFS TO COS
GooseFS-Lite
Online Tools
Diagnostic Tool
Use Cases
Overview
Access Control and Permission Management
Performance Optimization
Accessing COS with AWS S3 SDK
Data Disaster Recovery and Backup
Domain Name Management Practice
Image Processing
Audio/Video Practices
Workflow
Direct Data Upload
Content Moderation
Data Security
Data Verification
Big Data Practice
COS Cost Optimization Solutions
Using COS in the Third-party Applications
Migration Guide
Migrating Local Data to COS
Migrating Data from Third-Party Cloud Storage Service to COS
Migrating Data from URL to COS
Migrating Data Within COS
Migrating Data Between HDFS and COS
Data Lake Storage
Cloud Native Datalake Storage
Metadata Accelerator
GooseFS
Data Processing
Data Processing Overview
Image Processing
Media Processing
Content Moderation
File Processing Service
File Preview
Troubleshooting
Obtaining RequestId
Slow Upload over Public Network
403 Error for COS Access
Resource Access Error
POST Object Common Exceptions
API Documentation
Introduction
Common Request Headers
Common Response Headers
Error Codes
Request Signature
Action List
Service APIs
Bucket APIs
Object APIs
Batch Operation APIs
Data Processing APIs
Job and Workflow
Content Moderation APIs
Cloud Antivirus API
SDK Documentation
SDK Overview
Preparations
Android SDK
C SDK
C++ SDK
.NET(C#) SDK
Flutter SDK
Go SDK
iOS SDK
Java SDK
JavaScript SDK
Node.js SDK
PHP SDK
Python SDK
React Native SDK
Mini Program SDK
Error Codes
Harmony SDK
Endpoint SDK Quality Optimization
Security and Compliance
Data Disaster Recovery
Data Security
Cloud Access Management
FAQs
Popular Questions
General
Billing
Domain Name Compliance Issues
Bucket Configuration
Domain Names and CDN
Object Operations
Logging and Monitoring
Permission Management
Data Processing
Data Security
Pre-signed URL Issues
SDKs
Tools
APIs
Agreements
Service Level Agreement
Privacy Policy
Data Processing And Security Agreement
Contact Us
Glossary
DokumentasiCloud Object StorageUser ToolsCOSCLI (Beta)Common CommandsObtaining Statistics on Different Types of Objects - du

Obtaining Statistics on Different Types of Objects - du

PDF
Mode fokus
Ukuran font
Terakhir diperbarui: 2025-05-09 18:27:39
The 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.
Note:
If you need to use this command to stat information of all objects, when you perform authorization policy, set action to cos:HeadBucket, cos:GetBucket.
If you need to use this command to stat all historical version information, when you perform authorization policy, set action to cos:HeadBucket, cos:GetBucketVersioning, cos:GetBucketObjectVersions.
For more authorizations, please refer to CAM-Enabled API.

Command Syntax

./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.
Note:
--include and --exclude support standard regular expression syntax, so you can use them to filter out objects that meet specific criteria.
When using zsh, you may need to enclose the pattern string with double quotation marks.
./coscli du cos://bucket1/picture/ --include ".*\\.mp4$"
For more general options for this command (such as switching buckets or user accounts), see Common Options.

Examples

Listing statistics on objects in the bucket1 bucket

./coscli du cos://bucket1
The returned information includes the number and size of objects in different storage classes, total number of objects, and total object size in the bucket. Below is an example:
STORAGE CLASS | OBJECTS COUNT | TOTAL SIZE
--------------------------+---------------+-------------
STANDARD | 2 | 164 B
STANDARD_IA | 0 | 0 B
INTELLIGENT_TIERING | 0 | 0 B
ARCHIVE | 0 | 0 B
DEEP_ARCHIVE | 0 | 0 B
MAZ_STANDARD | 0 | 0 B
MAZ_STANDARD_IA | 0 | 0 B
MAZ_INTELLIGENT_TIERING | 0 | 0 B
MAZ_ARCHIVE | 0 | 0 B
--------------------------+---------------+-------------
INFO[2022-12-14 17:35:41] Total Objects Count: 2
INFO[2022-12-14 17:35:41] Total Objects Size: 164 B

Listing statistics on objects in the picture directory in the bucket1 bucket

./coscli du cos://bucket1/picture/

Listing statistics on all MP4 objects in the picture directory in the bucket1 bucket

./coscli du cos://bucket1/picture/ --include ".*\\.mp4$"

Listing statistics on all non-MD objects in the picture directory in the bucket1 bucket

./coscli du cos://bucket1/picture/ --exclude ".*\\.md$"

List the Files in the bucket1 bucket and the Statistical Information of All Earlier Versions

./coscli du cos://bucket1 --all-versions
The returned result is as follows. The output information includes: the number and size of objects under each storage type in the bucket, the total number of objects in the bucket, and the total capacity of objects in the bucket.
STORAGE CLASS | OBJECTS COUNT | TOTAL SIZE
--------------------------+---------------+-------------
STANDARD | 545 | 1.14 MB
STANDARD_IA | 0 | 0 B
INTELLIGENT_TIERING | 0 | 0 B
ARCHIVE | 0 | 0 B
DEEP_ARCHIVE | 13 | 11.74 KB
MAZ_STANDARD | 0 | 0 B
MAZ_STANDARD_IA | 0 | 0 B
MAZ_INTELLIGENT_TIERING | 0 | 0 B
MAZ_ARCHIVE | 0 | 0 B
--------------------------+---------------+-------------
INFO[2025-02-25 17:36:36] Total Objects Count: 558
INFO[2025-02-25 17:36:36] Total Objects Size: 1.15 MB
INFO[2025-02-25 17:36:36] Total DeleteMarker Count: 501


Bantuan dan Dukungan

Apakah halaman ini membantu?

masukan