tencent cloud

Feedback

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.
    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