s3Move

Moves an object between S3 (or S3-compatible) buckets (or keys) by copying the object and then deleting the source.

s3Move(srcBucket, srcObject, trgBucket [, trgObject, acl, accessKeyId, secretKey, host]) → returns void

This function requires RustCFML.  Not supported on Lucee, Adobe ColdFusion, etc.

Argument Reference

srcBucket string
Required

The source bucket name.

srcObject string
Required

The source object key.

trgBucket string
Required

The destination bucket name.

trgObject string

The destination object key. Defaults to the source object key.

acl string

Object ACL to apply to the move (accepted for compatibility; not enforced).

accessKeyId string

Inline AWS access key id. Overrides credentials from Application.cfc and environment variables.

secretKey string

Inline AWS secret access key.

host string

Inline endpoint URL for S3-compatible providers (e.g. Cloudflare R2, MinIO).

Examples
Sample code invoking the s3Move function

Copies the object to the target and deletes the source.

s3Move("src-bucket", "reports/q3.pdf", "archive-bucket");

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

Fork me on GitHub