ls
command is used to query the list of buckets, objects in a bucket, and objects in a directory../coscli ls [cos://<bucket-name>[/prefix/]] [flag]
ls
includes the following parameters:Parameter Format | Description | Example |
cos://<bucket-name> | Specifies the optional 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/ |
ls
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. |
-r | --recursive | Specifies whether to traverse directories recursively and list all objects. |
None | --limit | Specifies the maximum quantity to be listed. (If 0 or no value is configured, the default value is 10000) |
--include
and --exclude
support standard regular expressions. You can use regular expressions to filter objects that meet your requirements.zsh
, you may need to add double quotes at both ends of the pattern
string../coscli ls cos://bucket1 -r --include ".*.mp4"
./coscli ls
BUCKET NAME | REGION | CREATE DATE--------------------------------+-----------------+-----------------------examplebucket-1250000000 | ap-nanjing | 2022-01-01T00:00:00Z--------------------------------+-----------------+-----------------------TOTAL BUCKETS: | 1------------------+-----------------------
bucket1
bucket./coscli ls cos://bucket1
KEY | TYPE | LAST MODIFIED | SIZE-----------------+----------+--------------------------+---------test.txt | STANDARD | 2022-01-01T00:00:00.000Z | 2 B-----------------+----------+--------------------------+---------TOTAL OBJECTS: | 1---------------------------+---------
picture
directory in the bucket1
bucket./coscli ls cos://bucket1/picture/
KEY | TYPE | LAST MODIFIED | SIZE-------------------+----------+--------------------------+---------picture/subfolder | DIR | |picture/pic1.png | STANDARD | 2022-01-01T00:00:00.000Z | 162 B-------------------+----------+--------------------------+---------TOTAL OBJECTS: | 2-----------------------------+---------
picture
directory in the bucket1
bucket recursively./coscli ls cos://bucket1/picture/ -r
KEY | TYPE | LAST MODIFIED | SIZE----------------------------+----------+--------------------------+---------picture/subfolder/pic2.png | DIR | |picture/subfolder | DIR | |picture/pic1.png | STANDARD | 2022-01-01T00:00:00.000Z | 162 B----------------------------+----------+--------------------------+---------TOTAL OBJECTS: | 2-----------------------------+---------
bucket1
bucket recursively./coscli ls cos://bucket1 -r --include .*.mp4
bucket1
bucket recursively./coscli ls cos://bucket1 -r --exclude .*.mp4
test
in the picture
directory in the bucket1
bucket./coscli ls cos://bucket1/picture -r --include ^picture/test.* --exclude .*.jpg
Apakah halaman ini membantu?