Openstack Swift 批量删除 (bulk delete)

Bulk Delete

Requests must be of type DELETE, and have an Content-Type header of text/plain. The data is a new-line separated list of url-encoded objects or containers to be deleted. Containers being deleted must already be empty. Use a query string of ?bulk-delete. As above, the response format defaults to text/plain but the Accept header can be used to specify application/json, application/xml, or text/xml. Also as above, the status-code of the reply will always be 200 OK, and actual results will be included in the body of the response.

Create a file containing the objects and containers to be deleted.

alpha/one.txt
alpha/two.txt
alpha
beta/three.txt
beta/four.txt
beta

curl -i -H "X-Auth-Token: <token>" -H "Content-Type: text/plain" [-H "Accept: <response-format>"] <storage_url>/?bulk-delete -X DELETE --data-binary @<list-file>

curl -i -H "X-Auth-Token: AUTH_tkd17e7282441a4bde9e09094f02a36108" \
    -H "Accept: application/json" -H "Content-Type: text/plain" \
    -X DELETE http://swift.example.com/v1/AUTH_bob/?bulk-delete \
    --data-binary @bulk-delete-list.txt
HTTP/1.1 200 OK
Content-Type: application/json
X-Trans-Id: txd7e5e895d61f49d19f22f-0052096a31
Date: Mon, 12 Aug 2013 23:05:21 GMT
Transfer-Encoding: chunked


https://www.swiftstack.com/docs/admin/middleware/bulk.html

posted on 2020-10-20 17:36  liujx2019  阅读(346)  评论(0编辑  收藏  举报

导航