Rename a folder in S3 without the CLI: what happens and how to check

by 10 min read
Folder rename in three steps: copy every file to the new name, check the names, then delete the originals
On this page

AWS’s docs say console folders can be created, deleted and made public, but you can’t rename a folder in S3 like one on your laptop.

Quick start: In Opndrive, open the folder’s More actions menu, choose Rename, and type the new name.
It copies every file to the new name, checks they all arrived, and only then deletes the originals.

Bash
docker run -d --restart unless-stopped --name opndrive -p 3000:3000 ghcr.io/opndrive/opndrive:latest

That starts Opndrive on port 3000; open it and connect your bucket.1

How we tested: We ran the commands in this post on MinIO RELEASE.2025-07-23T15-54-02Z, SeaweedFS 4.52, Garage 2.6.0 and RustFS 1.0.7 on 2 Dec 2026. Each server got a fresh test bucket (my-bucket in the commands) holding small text files and a folder marker under holiday-2025/, copied to trips-2025/ for the comparison, deleted after the run. The output under a command is MinIO’s; where a server printed something else, the note under it says so. A command we could not run here says why under it.

What we read rather than ran: Opndrive’s rename steps, messages and request counts come from its source code, and provider prices, limits and versioning from their docs.

Why S3 can’t rename a folder in place

An ordinary (general purpose) S3 bucket has no rename for folders. A folder is only a name prefix that many files share, so a rename copies each file to a key with the new prefix, then deletes the original. Each file’s copy is all-or-nothing; the folder as a whole is not.23

Each file is an object, and its key is its full name. The S3 console shows the start of a key, up to a slash, as a folder (AWS folder docs). Renaming holiday-2025 changes every key:

Key before Key after
holiday-2025/ trips-2025/
holiday-2025/beach.jpg trips-2025/beach.jpg

The first row is the folder marker, a 0-byte object the console creates, and it moves too. In our test, SeaweedFS 4.52 differed: copying the marker returned NoSuchKey, so no marker appeared at the new name. AWS’s RenameObject works only in S3 Express One Zone directory buckets, and not on keys ending in /.4

Before you click Rename

  • A CORS rule. CORS (cross-origin resource sharing) is the bucket rule that lets a web page on one address call storage on another. A copy is a PUT with an x-amz-copy-source header, so the browser asks the bucket first (a preflight). Allow GET, PUT, POST, DELETE, HEAD and the copy headers from Opndrive’s exact address, not *, so other sites can’t use the rule.5 See the CORS rule for your provider.
  • A key that can delete. It needs s3:ListBucket, s3:GetObject, s3:PutObject and s3:DeleteObject.6 A key that renames can also delete, so use a one-bucket IAM policy for a web client.
  • A quiet folder. Opndrive lists the folder once, before copying, so don’t add files until the rename ends.
  • No archived files. On AWS, files in Glacier Flexible Retrieval or Deep Archive must be restored before they can be copied.7
  • A note. Write down the file count, and the size and ETag of two or three files. An ETag is a fingerprint of a file’s contents.8

Rename a folder in S3 with Opndrive

  1. In My Drive, open the folder’s More actions menu and choose Rename.
  2. The first time, a Rename Folder notice says each file is copied and the original deleted. Choose I Understand.
  3. Type the new name (no /) and choose Rename.
  4. The row shows the new name at once, before the copy finishes. Wait for "holiday-2025" renamed to "trips-2025" or a message from the next section; there’s no progress bar.

If that name is already taken

Folder already exists offers Keep both folders, the default, which picks a name such as trips-2025 (1), or Merge with existing folder. Before merging, check for file names both folders share: Opndrive copies without asking and overwrites any same-named file already in the destination folder, permanently in an unversioned bucket. Then choose Continue.

What happens to every file if the rename stops halfway

Nothing is deleted until every file is copied and found at the new name (Opndrive file management docs):

Phase Opndrive sends If it fails here
1. Copy A listing, then one CopyObject per file, 8 at a time Nothing deleted; partial copies stay at the new name
2. Verify A listing of the new folder, checked name by name Nothing deleted
3. Delete DeleteObjects, 1,000 names per request, each result read All files at the new name; some originals left

Phases 1 and 2 fail with “Rename failed, so nothing was changed – your original folder is intact and you can safely try again.” A retry copies any partial copies again. Phase 3 reports old files that “could not be removed and still exist at the previous path”; fix the cause, such as a missing delete permission, then delete them.9

Rename states: copy, verify, delete. A failure in the first two leaves originals whole; a failed delete leaves some.
Nothing is deleted until every copy is verified.

If the tab closes during phase 1 or 2, the old folder stays whole. Rename it to the same name again and choose Merge with existing folder: the check compares every name, so files already there can’t hide a missing one.

Check the copy

Compare names and count, then sizes, then ETags. Opndrive’s own check compares names only.9 A changed ETag is normal for a file uploaded in parts (multipart), because its copy is a single-part object,7 and when the bucket’s default encryption is SSE-KMS, whose ETags aren’t an MD5 of the data.8

In Opndrive

Open each noted file’s More actions, then File information, and compare its Size and ETag.

The Details panel for a file, listing its size, ETag and storage class
Compare Size and ETag with your notes from before the rename.

With the AWS CLI

Add --endpoint-url for a server other than AWS. Before the rename, save every key, size and ETag; the command prints the object count:

Bash
aws s3api list-objects-v2 --bucket my-bucket --prefix holiday-2025/ \
  --query 'Contents[].[Key,Size,ETag]' --output text > before.txt
wc -l < before.txt
1051

Tested on all four servers.

Keep the trailing slash: holiday-2025 alone also matches holiday-2025-old/.11 After the rename, run this. It skips the folder marker, which SeaweedFS 4.52 didn’t copy. It prints “names and sizes match” when every file arrived at its size, then any line whose ETag changed, or “all ETags match”:

Bash
aws s3api list-objects-v2 --bucket my-bucket --prefix trips-2025/ \
  --query 'Contents[].[Key,Size,ETag]' --output text | awk -F'\t' '$1 !~ /\/$/' > after.txt
sed 's#^holiday-2025/#trips-2025/#' before.txt | awk -F'\t' '$1 !~ /\/$/' > expected.txt
cut -f1,2 expected.txt > expected-sizes.txt
cut -f1,2 after.txt > after-sizes.txt
diff expected-sizes.txt after-sizes.txt && echo "names and sizes match"
diff expected.txt after.txt | grep '^>' || echo "all ETags match"
names and sizes match
all ETags match

Tested on all four servers.

What a rename costs in requests

A rename sends one copy per file, a few listings, and one delete per 1,000 files: for 10,500 files, 23 listings, 10,500 copies and 11 deletes. Providers bill them differently:

Provider Copies, listings Deletes Early-delete minimum
Amazon S3 PUT, COPY, POST, LIST rate12 Free 30 days (Standard-IA), 90 (Glacier Flexible), 180 (Deep Archive)13
Cloudflare R2 Class A14 DeleteObject free None (Standard), 30 days (Infrequent Access)
Backblaze B2 Class C15 Class A Not covered
Wasabi No charge16 No charge 90 days17
Your own server No charge No charge None; needs disk for both copies

A rename deletes originals minutes after copying them, so files younger than the minimum are billed for the remaining days.

Versioned buckets keep the old folder

Versioning makes a bucket keep older copies of each file. There, Opndrive’s delete names no version, so S3 adds a delete marker, a placeholder that hides the file, and keeps the old version, billed as a full object.1018 Each retried copy adds a version too.7 Remove leftovers by version ID or with a lifecycle rule, unless the bucket uses S3 Object Lock. Copies don’t inherit per-object retention periods or legal holds,2 and Opndrive’s delete still hides locked originals behind delete markers without failing. Version-ID deletes and lifecycle rules can’t remove a locked version until its retention expires and any legal hold is lifted.2021 Garage has no versioning, so its deletes are final.19

Where Opndrive’s rename stops

There’s no Move or Copy action: a rename stays in the same parent folder and bucket, and it doesn’t clean up old versions. On AWS, a renamed file under 5 GiB lands in the bucket’s default storage class (price tier), because Opndrive’s copy names no class and a copy “does not inherit the storage class”.7 Check Storage Class in File information.

Opndrive can’t rename SSE-C encrypted files: its copy sends no customer key, so phase 1 fails.7 It sends no encryption setting either. On AWS, a file’s SSE-KMS encryption reverts to the bucket’s default before the original is deleted: SSE-S3, unless the bucket defaults to your KMS key.7

When this doesn’t fit: a backend job, Batch Operations or a CDN

  • A backend API or script near the bucket suits very large folders, or teams whose people shouldn’t hold delete-capable keys. Keys stay on the server and renames can be logged, but you run and secure that service. aws s3 mv --recursive copies then deletes each object;22 preview it with --dryrun.
  • S3 Batch Operations on AWS copies listed objects up to 5 GB each, with no delete step.23
  • A CDN or reverse proxy rewrite fits when you only need a new URL: an edge rule or your Nginx, Caddy or Traefik proxy maps it to the old path. Nothing moves, but every link depends on that rule.

References

  1. AWS: What is Amazon S3?
  2. AWS: RenameObject
  3. AWS: CopyObject
  4. AWS: Object
  5. AWS: DeleteObjects
  6. AWS CLI: list-objects-v2
  7. Amazon S3 pricing
  8. AWS: Storage classes
  9. Cloudflare R2 pricing
  10. Backblaze B2 transaction pricing
  11. Wasabi pay-as-you-go FAQ
  12. Wasabi minimum storage duration
  13. AWS: S3 Versioning
  14. Garage: S3 compatibility
  15. AWS: S3 Object Lock
  16. AWS: Expiring objects
  17. AWS CLI: mv
  18. AWS: Batch Operations copy

Try Opndrive

Opndrive gives any S3-compatible bucket a Drive-like web interface you host yourself.
See it on GitHub or read the docs.


  1. Opndrive: Deployment ↩
  2. AWS: Copying and renaming objects ↩↩
  3. AWS: What is Amazon S3?[1] ↩
  4. AWS: RenameObject[2] ↩
  5. Opndrive: Configure CORS ↩
  6. Opndrive: Connecting storage ↩
  7. AWS: CopyObject[3] ↩↩↩↩↩↩
  8. AWS: Object[4] ↩↩
  9. Opndrive: S3 API layer ↩↩
  10. AWS: DeleteObjects[5] ↩
  11. AWS CLI: list-objects-v2[6] ↩
  12. Amazon S3 pricing[7] ↩
  13. AWS: Storage classes[8] ↩
  14. Cloudflare R2 pricing[9] ↩
  15. Backblaze B2 transaction pricing[10] ↩
  16. Wasabi pay-as-you-go FAQ[11] ↩
  17. Wasabi minimum storage duration[12] ↩
  18. AWS: S3 Versioning[13] ↩
  19. Garage: S3 compatibility[14] ↩
  20. AWS: S3 Object Lock[15] ↩
  21. AWS: Expiring objects[16] ↩
  22. AWS CLI: mv[17] ↩
  23. AWS: Batch Operations copy[18] ↩

Curious about Opndrive?

Take a look at our FAQ to learn more.

Opndrive

Ready to take control of your S3 storage?

Connect your S3 bucket in minutes and start managing your files with Opndrive's beautiful, modern interface.

Build Opndrive with us

Live demos, reviews on your PRs, and a hand when you get stuck.

Be an early member
Join our Discord