成长值: 348 签到天数: 4741 天 [LV.Master]伴坛终老
|
发表于 2018/8/27 04:52
|
显示全部楼层
|阅读模式
|Google Chrome 68.0.3440.106 |Windows 10
安装COSCMD
- yum -y install wget
- wget https://bootstrap.pypa.io/2.6/get-pip.py
- python get-pip.py
- pip install coscmd
复制代码
测试运行
个人中心找到AK和SK(AccessKey/SecretKey)
https://console.cloud.tencent.com/cam/capi
获取appid
https://console.cloud.tencent.com/developer
可用地域,根据自己服务器地域创建,下方需要加-r参数
https://cloud.tencent.com/doc/product/436/6224
参数:
- coscmd config -a ak -s sk -b bucketname-appid -r ap-guangzhou -m 10
复制代码
示例:
- coscmd config -a AKIDcMIG6l2VXXyTYcqAe2XQmMlz3xjFcI3h -s b6Z1FWEM3tZCye9XmzzwkQCrBmxvnJzK -b test-1257777776 -r ap-guangzhou -m 10
复制代码
测试输出
输出:
[common]
secret_id = AKIDcMIG6l2VXXyTYcqAe2XQmMlz3xjFcI3h
secret_key = b6Z1FWEM3tZCye9XmzzwkQCrBmxvnJzK
bucket = test-1257777776
region = ap-guangzhou
max_thread = 10
part_size = 1
schema = https
verify = md5
anonymous = False
schema 建议改成http,否则目前COSCMD版本会提示https警告
到此安装完毕。
腾讯云免费50G空间和10G外网流量。
上传文件
参数:
r 文件夹递归同步上传,一般配合s参数忽略重复文件上传到空间
s 跳过空间服务器x-cos-meta-md5头部值一样的md5相同的文件
--skipmd5 跳过本地md5验证,直接上传
--ignore 忽略.txt和.doc的后缀文件(--ignore *.txt,*.doc)
上传单个文件:
- coscmd upload /root/lxzPV.mp4 video/lxzPV.mp4
复制代码
输出:
Upload /root/lxzPV.mp4 => cos://test/video/lxzPV.mp4
Continue uploading from last breakpoint
36.7MB [00:00, 193GB/s]
Completing multiupload, please wait
上传文件夹:
- coscmd upload -r /root/video test/
复制代码
输出:
Upload /root/video/lxzPV.mp4 => cos://test/test/video/lxzPV.mp4
Continue uploading from last breakpoint
36.7MB [00:00, 155GB/s]
Completing multiupload, please wait
Upload /root/video/123.mp4 => cos://test/test/video/123.mp4
Continue uploading from last breakpoint
36.7MB [00:00, 194GB/s]
Completing multiupload, please wait
2 files successful, 0 files failed
列举腾讯云云cos空间里面的所有文件
参数
r 递归打印,并且会在末尾返回列出文件的数量和大小之和
n 设置打印数量的最大值(-n 10)
显示test目录文件
示例:
结果
test/video/123.mp4 36622683 2018-08-30 05:58:11
test/video/lxzPV.mp4 36622683 2018-08-30 05:58:10
Files num: 2
Files size: 73245366
显示文件信息
示例:
- coscmd info test/video/123.mp4
复制代码
结果
Info with : http://test-1257777776.cos.ap-guangzhou.myqcloud.com/test/video/123.mp4
+------------------------+-----------------------------------------------------------+
| test/video/123.mp4 | |
+------------------------+-----------------------------------------------------------+
| File size | 36622683 |
| Last mod | 2018-08-30 05:58:11 |
| ACL | qcs::cam::uin/1265578519:uin/1265578519: FULL_CONTROL |
+------------------------+-----------------------------------------------------------+
删除文件
参数
r 删除文件夹操作
f 跳过验证码确认
删除空间test里面的视频lxzPV.mp4
- coscmd delete -f test/video/123.mp4
复制代码
输出:
Delete cos://test/test/video/123.mp4
删除空间test中的所有文件:
输出:
Delete CF CDNlist.txt
Delete test/video/lxzPV.mp4
Delete the remaining files again
2 files successful, 0 files failed
清除未完成上传文件碎片:
腾讯计费模式是把这个一起算了,如果上传失败产生的碎片会一直存在导致费用异常,推荐上传之前清理掉之前的碎片
输出:
Aborting part, Key:2018-12-18/2018-12-18~07-01-56.7z, UploadId:1257777776ed234ada1406b15644a673864dc1ccc1910ff309126dcecc8234a9e094d79131
1 files successful, 0 files failed
帖子原帖永久链接:http://bbs.itzmx.com/thread-87561-1-1.html
|
|