tencent cloud

masukan

Querying Bucket/Object List - ls

Terakhir diperbarui:2022-05-09 14:18:32

    The ls command is used to query the list of buckets, objects in a bucket, and objects in a directory.

    Command Syntax

    ./coscli ls [cos://bucketAlias[/prefix/]] [flag]
    
    Note:

    ls includes the following optional parameters:

    Parameter Format Description Example
    cos://bucketAlias Specifies a bucket. cos://bucket1
    /prefix/ Specifies a directory. /picture/

    ls includes the following optional flags:

    Flag Abbreviation Flag Name Description
    None --include Includes specific objects.
    None --exclude Excludes specific objects.
    -r --recursive Specifies whether to traverse directories recursively and list all objects.
    Note:

    • --include and --exclude support standard regular expressions. You can use regular expressions to filter objects that meet your requirements.
    • When using zsh, you may need to add double quotes at both ends of the pattern string.
    ./coscli ls cos://bucket1 -r --include ".*.mp4"
    

    Examples

    Listing all buckets of the current account

    ./coscli ls
    

    Listing objects

    Listing all objects in the bucket1 bucket

    ./coscli ls cos://bucket1
    

    Listing all objects and subdirectories in the picture directory in the bucket1 bucket

    ./coscli ls cos://bucket1/picture/
    

    Listing all objects in the picture directory in the bucket1 bucket recursively

    ./coscli ls cos://bucket1/picture/ -r
    

    Listing all MP4 objects in the bucket1 bucket recursively

    ./coscli ls cos://bucket1 -r --include .*.mp4
    

    Listing all non-MP4 objects in the bucket1 bucket recursively

    ./coscli ls cos://bucket1 -r --exclude .*.mp4
    

    Listing all non-JPG objects prefixed with test in the picture directory in the bucket1 bucket

    ./coscli ls cos://bucket1/picture -r --include ^picture/test.* --exclude .*.jpg
    
    Hubungi Kami

    Hubungi tim penjualan atau penasihat bisnis kami untuk membantu bisnis Anda.

    Dukungan Teknis

    Buka tiket jika Anda mencari bantuan lebih lanjut. Tiket kami tersedia 7x24.

    Dukungan Telepon 7x24