官方文檔:
https://docs.ucloud.cn/ufile/tools/tools/tools_filelinux
ucloud 廣州地域
api
公私鑰內容以下:ide
公鑰:TOKEN_d2baa99-ba02-4570-a952-390f0e0fc27c 私鑰:d3f33c6b-6a4-4555-9517-b9c0c235a75f [root@localhost soft]# cat /data/soft/linux64/guangdong-config.cfg { "public_key" : "TOKEN_d2bbaa99-ba02-4570-a952-390f0e0fc27c", "private_key" : "d3f33c6b-6ba4-4555-9517-b9c0c235a75f", "proxy_host" : "www.cn-gd.ufileos.com", "api_host" : "api.spark.ucloud.cn" }
提示:
上海地區的proxy_host地址爲:www.cn-sh2.ufileos.com
北京地區的proxy_host地址爲:www.cn-bj.ufileos.com
廣州地區的proxy_host地址爲:www.cn-gd.ufileos.com
命令存放路徑:
[root@localhost linux64]# which filemgr
/usr/local/bin/filemgr測試
[root@localhost pic]# pwd
/data/www/code/upload/picspa
測試:
對於文件夾中大文件較多的狀況分片上傳文件夾相比普通上傳文件夾要快:
--dir ./pic # 指定上傳的目錄
--trimpath /data/www/code/upload/ #去掉前綴目錄
--bucket wbgz-test # 指定bucket名稱
--speedlimit 102400000 #限制上傳的速度爲100M (單位bytes/s )code
filemgr -config /data/soft/linux64/guangdong-config.cfg --action mput --dir ./pic --trimpath /data/www/code/upload/ --bucket wbgz-test --speedlimit 102400000
提示:上傳報錯的話,能夠更新下./filemgr --updatecdn
[root@localhost upload]# filemgr -config /data/soft/linux64/guangdong-config.cfg --action mput --dir ./pic --trimpath /data/www/code/upload/ --bucket wbgz-test --speedlimit 102400 2020/05/23 15:41:11.905781 [INFO]Upload File[ wbgz-test : pic/2.txt ] Success 2020/05/23 15:41:12.006077 [INFO]Upload File[ wbgz-test : pic/4.txt ] Success 2020/05/23 15:41:12.106297 [INFO]Upload File[ wbgz-test : pic/6.txt ] Success 2020/05/23 15:41:12.206557 [INFO]Upload File[ wbgz-test : pic/3.txt ] Success 2020/05/23 15:41:12.306843 [INFO]Upload File[ wbgz-test : pic/5.txt ] Success 2020/05/23 15:41:12.407103 [INFO]Upload File[ wbgz-test : pic/1.txt ] Success
[root@localhost upload]# filemgr -config /data/soft/linux64/guangdong-config.cfg --action sync --dir ./pic --trimpath /data/www/code/upload/ --bucket wbgz-test --speedlimit 102400 2020/05/23 15:46:36.518613 [INFO]Syncing... ======================== | succ| fail| ------------------------ | 0| 0| ========================
建立測試文件增量上傳:blog
[root@localhost upload]# pwd /data/www/code/upload [root@localhost upload]# touch pic/7.txt [root@localhost upload]# filemgr -config /data/soft/linux64/guangdong-config.cfg --action sync --dir ./pic --trimpath /data/www/code/upload/ --bucket wbgz-test --speedlimit 102400 2020/05/23 15:47:52.674122 [INFO]Syncing... 2020/05/23 15:47:52.736405 [INFO] Sync Successed[ /data/www/code/upload/pic/7.txt ] => wbgz-test : 7.txt ======================== | succ| fail| ------------------------ | 1| 0| ========================
1.帶有文件夾類型的:
a. 刪除testA 文件夾全部的文件,徹底匹配testA,這種形式不匹配:testAA,testABci
./filemgr --action batch-delete --bucket demo --pattern "^testA\/" [root@localhost upload]# filemgr -config /data/soft/linux64/config.cfg --action batch-delete --bucket wbtdspcdn-shanghai --pattern "^userpic\/" 2020/01/11 12:16:54.507451 [INFO]batch delete starting... 2020/01/11 12:16:54.635836 [INFO]Delete [wbtdspcdn-shanghai:userpic/10/1577505964286811.jpg] success 2020/01/11 12:16:54.635931 [INFO]DeleteFile Success|FileName:userpic/10/1577505964286811.jpg|CreateTime:1578715588 2020/01/11 12:16:54.638053 [INFO]Delete [wbtdspcdn-shanghai:userpic/3/1578281112975545.jpg] success 2020/01/11 12:16:54.638105 [INFO]DeleteFile Success|FileName:userpic/3/1578281112975545.jpg|CreateTime:1578715588 2020/01/11 12:16:54.643059 [INFO]Delete [wbtdspcdn-shanghai:userpic/1/1577424617373039.jpg] success 2020/01/11 12:16:54.643109 [INFO]DeleteFile Success|FileName:userpic/1/1577424617373039.jpg|CreateTime:1578715588 2020/01/11 12:16:54.643148 [INFO]End without next marker
b. 刪除testA 文件夾全部的文件,匹配testA,這種形式也匹配: AAtestA/文檔
./filemgr --action batch-delete --bucket demo --pattern "testA\/"
c. 刪除testA 文件夾下指定文件類型jpg,徹底匹配testA,這種形式不匹配:testAA,testAB AAtest
./filemgr --action batch-delete --bucket demo --pattern "^testA\/.*\.jpg$" 刪除存儲wbtdpdn-shanghai 文件夾userpic 下的後綴爲png的文件: [root@localhost upload]# filemgr -config /data/soft/linux64/config.cfg --action batch-delete --bucket wbtdspcdn-shanghai --pattern "^userpic\/.*\.png$" 2020/01/11 12:28:55.535250 [INFO]batch delete starting... 2020/01/11 12:28:55.670083 [INFO]Delete [wbtdspcdn-shanghai:userpic/1/112211.png] success 2020/01/11 12:28:55.670198 [INFO]DeleteFile Success|FileName:userpic/1/112211.png|CreateTime:1578716799 2020/01/11 12:28:55.719129 [INFO]Delete [wbtdspcdn-shanghai:userpic/10/112211.png] success 2020/01/11 12:28:55.719173 [INFO]DeleteFile Success|FileName:userpic/10/112211.png|CreateTime:1578716694 2020/01/11 12:28:55.719206 [INFO]End without next marker
提示:要想在控制檯刪除雲存儲buckets目錄下的文件。必須先保證雲存儲buckets裏面是空的,而後就是刪除掉buckets中文件夾下的key文件, 而後刪除buckets,最後纔是刪除雲存儲簡單演示到此處