./coscli ls [cos://<bucket-name>[/prefix/]] [flag]
参数格式 | 参数用途 | 示例 |
cos://<bucket-name> | 使用桶别名访问:cos://example-alias 使用桶名称访问:cos://examplebucket-1250000000 | |
/prefix/ | 可选参数。指定某一文件夹 | /picture/ |
flag 简写 | flag 全称 | flag 用途 |
-h | --help | 查看该命令的具体用法 |
无 | --include | 包含特定模式的文件 |
无 | --exclude | 排除特定模式的文件 |
-r | --recursive | 是否递归地遍历文件夹,并列出所有文件 |
无 | --limit | 指定列出的最大数量(传0或不传则默认为10000) |
--include
和--exclude
支持标准正则表达式的语法,您可以使用它来过滤出符合特定条件的文件。./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------------------+-----------------------
./coscli ls cos://bucket1
KEY | TYPE | LAST MODIFIED | SIZE-----------------+----------+--------------------------+---------test.txt | STANDARD | 2022-01-01T00:00:00.000Z | 2 B-----------------+----------+--------------------------+---------TOTAL OBJECTS: | 1---------------------------+---------
./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-----------------------------+---------
./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-----------------------------+---------
./coscli ls cos://bucket1 -r --include .*.mp4
./coscli ls cos://bucket1 -r --exclude .*.mp4
./coscli ls cos://bucket1/picture -r --include ^picture/test.* --exclude .*.jpg
本页内容是否解决了您的问题?