Oss-如何配置ossutil工具?
./ossutil64 config -L ch
此命令设置中文交互的配置界面
https://help.aliyun.com/document_detail/50452.html
Oss-查看命令帮助
./ossutil64 help cp
Oss-从服务器上传单个文件到Oss
./ossutil cp /var/www/html/Films/1010/0591B2BD47C5B745C7E12DA4DA931F3C.mp4 oss://x-images-us/20190107/html/Films/1010/0591B2BD47C5B745C7E12DA4DA931F3C.mp4
或者
上传单个文件到oss上的一个目录
./ossutil cp /var/www/html/Prev.tar.gz oss://x-static-hd-001/20190107/
Oss-上传文件夹
上传文件夹 是否需要先创建好?不需要
官方有文档
https://help.aliyun.com/document_detail/50561.html
./ossutil cp -r /var/www/html/Films/1000 oss://x-static-hd-001/20190107/html/Films/1000
使用bash脚本
#!/bin/bash
./ossutil cp -r /var/www/html/Films/1002 oss://x-films-backup/html/Films/1002
./ossutil cp -r /var/www/html/Films/1003 oss://x-films-backup/html/Films/1003
./ossutil cp -r /var/www/html/Films/1004 oss://x-films-backup/html/Films/1004
Oss-下载单个文件
#!/bin/bash
./ossutil cp oss://x-static-hd-001/1010/0591B2BD47C5B745C7E12DA4DA931F3C.mp4 /var/www/html/Films/1010/0591B2BD47C5B745C7E12DA4DA931F3C.mp4
多个文件依次追加你的命令
Oss-下载整个文件夹
带上rf参数可以关闭消息提示
./ossutil64 cp -r oss://x-images-us/20190107/html/Films/1005 /var/www/html/Films
./ossutil64 cp -r oss://x-images-us/20190107/html/Films/1005 /var/www/html/Films
./ossutil64 cp -r -f oss://n-films-us/Pics /root
Oss-统计文件数量
#!/bin/bash
ls -l /var/www/html/Films/1000 |grep "^-"|wc -l
ls -l /var/www/html/Films/1001 |grep "^-"|wc -l
./ossutil64 ls oss://x-films-hk-02/1011/V1/ -s |grep "oss://"|wc -l
./ossutil64 ls oss://x-films-hk-02/1011/V2/ -s |grep "oss://"|wc -l
OSS-删除文件命令
删除整个文件夹
rm命令 -r -f
强制删除
./ossutil64 rm oss://x-images-us/20191106TBLes/_m/ -r -f
./ossutil64 rm oss://x-images-us/20191106TBLes/_s/ -r -f
./ossutil64 rm oss://x-video-us-001/Pics/1000/ -r -f