本文提供视频讲解,详细见地址:https://www.bilibili.com/video/BV1GV411y711
coscmd是COS的一个命令行工具,类似Linux下的终端命令,Windows下的cmd 命令,提供了COS对象操作的基本使用方法。 在腾讯云的cvm云主机上使用coscmd走的是腾讯云的内部网络(不会产生公网带宽费用),所以推荐使用腾讯云cvm云主机来对COS进行操作。
我们可以使用pip来安装coscmd,更多安装方式也可以参考:https://cloud.tencent.com/document/product/436/10866
pip install coscmd
语法
coscmd config -a secretID -s secretKey -b 桶名 -r 地域
执行命令后会在当前目录下生成一个cos.conf文件(~/.cos.conf),内容如下。
coscmd list
下载文件夹
coscmd download -r aef05045-967a-4b80-9bf1-113eb3863e10-1600681738/ ./
下载指定文件
coscmd download elfk.zip ./
coscmd upload ./test.zip /
coscmd delete test.zip
coscmd -h
config Config your information at first
upload Upload file or directory to COS
download Download file from COS to local
delete Delete file or files on COS
abort Aborts upload parts on COS
copy Copy file from COS to COS
move move file from COS to COS
list List files on COS
listparts List upload parts
info Get the information of file on COS
restore Restore
signurl Get download url
createbucket Create bucket
deletebucket Delete bucket
putobjectacl Set object acl
getobjectacl Get object acl
putbucketacl Set bucket acl
getbucketacl Get bucket acl
putbucketversioning
Set the versioning state
getbucketversioning
Get the versioning state
probe Connection test
optional arguments:
-h, --help show this help message and exit
-d, --debug Debug mode
-b BUCKET, --bucket BUCKET
Specify bucket
-r REGION, --region REGION
Specify region
-c CONFIG_PATH, --config_path CONFIG_PATH
Specify config_path
-l LOG_PATH, --log_path LOG_PATH
Specify log_path
--log_size LOG_SIZE specify max log size in MB (default 1MB)
--log_backup_count LOG_BACKUP_COUNT
specify log backup num
-v, --version show program's version number and exit
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。