Available in Classic and VPC
Delete an object stored in Ncloud Storage.
Deleted objects cannot be recovered. Buckets with versioning enabled will have a deletion marker added, and previous versions will be retained. If you use the --recursive option, first verify the items to be deleted using the --dryrun option.
Syntax
The rm syntax is as follows:
aws s3 rm \
<s3-uri> \
[--dryrun] \
[--quiet] \
[--include <include>] \
[--exclude <exclude>] \
[--recursive] \
[--only-show-errors] \
[--page-size <page-size>] \
--endpoint-url <endpoint-url>
Options
This section describes the options available when running rm.
Required options
The following options are required for rm.
| Options | Type | Required | Description |
|---|---|---|---|
<s3-uri> |
String | Required | Object's S3 URI
|
Optional options
These are the optional options for rm. Options that are not specified will use their default values.
| Options | Type | Required | Description |
|---|---|---|---|
--dryrun |
Boolean | Optional | Checks the results of the command without actually executing it. |
--quiet |
Boolean | Optional | Does not display the response. |
--include |
String | Optional | Includes only objects matching the specified pattern in the command.
|
--exclude |
String | Optional | Excludes objects matching the specified pattern from the command.
|
--recursive |
Boolean | Optional | Deletes all subobjects in the specified path. |
--only-show-errors |
Boolean | Optional | Displays only errors; other response values are not displayed. |
--page-size |
Integer | Optional | Number of items per page
|
Common options
For information about the options common to all aws subcommands, see Ncloud Storage options.
Examples
When you run the command, the path of the deleted object is displayed.
Command
The following is an example command for deleting a single object.
aws s3 rm s3://my-test-bucket/docs/moved.txt \
--endpoint-url=https://kr.ncloudstorage.com
The following is an example command for deleting all objects in a bucket, except those with a specific file extension.
aws s3 rm s3://my-test-bucket/ \
--recursive \
--exclude "*.jpg" \
--endpoint-url=https://kr.ncloudstorage.com
Output
The following is an example output for deleting a single object.
delete: s3://my-test-bucket/docs/moved.txt
The following is an example output for deleting all objects in a bucket, excluding those with specific file extensions. Folders created in the console are stored as empty objects and are therefore included in the list of items to be deleted.
delete: s3://my-test-bucket/docs/
delete: s3://my-test-bucket/docs/report.txt
delete: s3://my-test-bucket/sample.txt