s3Delete

Deletes an S3 bucket, or an object in it. Without objectName, the bucket is deleted. A bucket that isn't empty needs force=true.

s3Delete(bucketName [, objectName, force, accessKeyId, secretAccessKey, host, timeout]) → returns query

Argument Reference

bucketName string
Required

The bucket name.

objectName string

The object key. When omitted, the bucket is deleted.

force boolean

When true, a bucket that isn't empty is emptied and deleted.

accessKeyId string

The S3 access key ID. Defaults to the lucee.s3.accesskeyid system property or environment variable.

secretAccessKey string

The S3 secret access key. Defaults to the lucee.s3.secretaccesskey system property or environment variable.

host string

The hostname of an S3-compatible provider, without https://. Defaults to Amazon AWS.

timeout numeric
Default: 10000

The timeout in milliseconds.

Compatibility

Lucee:

Requires the S3 extension.

RustCFML:

Names the first two arguments bucket and object, and the secret key argument secretKey. Returns nothing. Doesn't list timeout.

Examples
Sample code invoking the s3Delete function

Removes one key from the bucket.

s3Delete("my-bucket", "logs/today.txt");

force=true empties the bucket before deleting it.

s3Delete("my-bucket", "", true);

Signup for cfbreak to stay updated on the latest news from the ColdFusion / CFML community. One email, every friday.

Fork me on GitHub