-
Notifications
You must be signed in to change notification settings - Fork 127
Delete Multiple Objects (DMO)
Timothy Kay edited this page Oct 9, 2013
·
1 revision
You can delete multiple objects:
aws dmo [-v] [--quiet] bucket object [object...]
deletes the list of objects from the bucket. The --quiet switch suppresses successful response information. The -v switch displays the XML request (among other things).
If object is "-", then a list of files (separated by whitespace) is read from stdin:
echo obj1 obj2 |aws dmo mybucket obj3 - obj4
deletes obj3, obj1, obj2, and obj4 from mybucket.
Note: if you delete a file that doesn't exist, S3 considers it a success, as long as you have write access to the bucket. Thus, you can test dmo by deleting non-existent files.
The native interface is also supported:
aws put --md5 bucket?delete file.xml
or via stdin:
aws put --md5 bucket?delete <file.xml
or generated from a script (also via stdin):
generate_xml |aws put --md5 bucket?delete
deletes the objects according to the XML. The data read from stdin is stored in a temporary file.
Example:
aws put --md5 bucket?delete -
<Delete>
<Object><Key>a</Key></Object>
</Delete>
^D
produces:
+-----+--------------+---------------+
| Key | Code | Message |
+-----+--------------+---------------+
| a | AccessDenied | Access Denied |
+-----+--------------+---------------+