Skip to content

rm (delete)

To remove an object:

sh
s3m rm <s3 provider>/<bucket>/object

Example to delete all files in bucket:

sh
s3m ls <s3-provider>/<bucket> | awk '{print $NF}' | xargs -t -P4 -I '{}' s3m rm <s3-provider>/<bucket>/'{}'

In this example xargs is used with options:

  • -t Print the command line
  • -P4 Run up to 4 max-procs

To abort a multipart upload:

sh
s3m rm <s3 provider>/<bucket> -a <UploadId>

to get the upload ID you could use s3m ls <s3 provider>/<bucket> -m

For example to abort all multipart uploads:

sh
s3m ls -m <s3>/<bucket> | awk '{system("s3m rm <s3>/<bucket>/"$5" -a "$4);}'

Released under the BSD License.