Find a File in an S3 Bucket When You Don’t Know the Folder

by 9 min read
Opndrive logo above the title "Find a File in an S3 Bucket When You Don't Know the Folder" on a blue background
On this page

The S3 console’s search box can’t find a file in a bucket when the file sits in a folder you haven’t opened.

Quick start: In Opndrive, open the bucket’s top level and type two or more letters of the name; it searches every folder below.
From a terminal, list every key and filter it, ignoring case:

Bash
aws s3 ls s3://my-bucket --recursive | grep -i invoice
2026-12-06 21:11:44          4 Invoice-0042.pdf
2026-12-06 21:11:45          4 clients/acme/2026/invoice-0007.pdf
2026-12-06 21:11:45          4 projects/q4/invoice-summary.csv

Lines 1, 2 and 3 differ by server:

Server Line 1 Line 2 Line 3
MinIO 2026-12-06 21:11:44 4 Invoice-0042.pdf 2026-12-06 21:11:45 4 clients/acme/2026/invoice-0007.pdf 2026-12-06 21:11:45 4 projects/q4/invoice-summary.csv
SeaweedFS 2026-12-06 21:11:53 4 Invoice-0042.pdf 2026-12-06 21:11:53 4 clients/acme/2026/invoice-0007.pdf 2026-12-06 21:11:54 4 projects/q4/invoice-summary.csv
Garage 2026-12-06 21:12:01 4 Invoice-0042.pdf 2026-12-06 21:12:01 4 clients/acme/2026/invoice-0007.pdf 2026-12-06 21:12:02 4 projects/q4/invoice-summary.csv
RustFS 2026-12-06 21:12:09 4 Invoice-0042.pdf 2026-12-06 21:12:10 4 clients/acme/2026/invoice-0007.pdf 2026-12-06 21:12:10 4 projects/q4/invoice-summary.csv

In our run, only the date and time at the start of each line differed between the four servers. They show when our setup uploaded each file, so your own upload times will show there.

The rest is for anyone who knows a file’s name, or a piece of it, but not its folder.

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 7 Dec 2026. Each server got a fresh test bucket (my-bucket in the commands) holding four small files in nested folders, such as clients/acme/2026/invoice-0007.pdf, plus a projects/ folder marker, deleted after the run. The output under a command is MinIO’s; where a server printed something else, the note under it says so.

What we read rather than ran: How Opndrive’s search matches names and folders, and which release holds the search fix, from its source code and release history.

Why typing the name in the S3 console finds nothing

A bucket, the container your files live in, has no real folders.[1] Every file is stored under its full name, its object key, such as clients/acme/2026/invoice-0007.pdf. A folder is only the first characters of that name, called a prefix.[2]

The S3 console shows one level at a time. It treats each / as a delimiter, the character that splits names into levels. It rolls every deeper key into one folder entry[2]. Its search box, Find objects by prefix,[3] keeps only keys that begin with what you type[2]. So invoice typed at the top of the bucket misses two files:

  • clients/acme/2026/invoice-0007.pdf, because its key begins with clients/.
  • Invoice-0042.pdf, because S3 key names are case-sensitive: a capital I and a small i count as different letters.[4]

The Cloudflare R2 dashboard also groups prefixes into folders[5]. Backblaze B2’s list call filters by prefix too[6]. So one fix works everywhere. Search from the top of the bucket with a tool that lists every key and ignores case.

Typing invoice: the console's prefix search finds nothing, while reading every key and ignoring case finds both files.
The console matches only the start of a key and respects case, while Opndrive’s search and grep -i read every key and ignore case.

Find a file in any folder of your S3 bucket with Opndrive

Opndrive is an open-source file manager for S3 buckets that you host yourself and open in a browser tab.

Keys, a CORS rule and a running Opndrive

With Docker installed, run this command, then open http://localhost:3000 in your browser (or your server’s address, if Docker runs on another machine):

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

The latest image is the newest release, v3.1.1 on 2026-12-07.[7][8] You also need:

  • Access keys that can list the bucket. Access keys are the key ID and secret your provider gave you. Search needs the s3:ListBucket permission.[9] Access keys limited to one bucket keep the damage small if they leak: create keys for a single bucket.
  • A CORS rule for the bucket: a bucket setting that lets a site at another address send it requests. Opndrive calls the bucket straight from your browser tab, so without the rule it cannot even list the bucket.[10] Follow the CORS steps for your provider.

Fill in the connection form, including the endpoint (your provider’s address), and click Connect to your S3 storage. Opndrive saves the access keys in localStorage, the browser’s storage for each site, so anyone using that browser profile can use them.

Search from the top of the bucket

  1. If you are inside a folder, click My Drive in the breadcrumbs (the folder path above the file list) or in the sidebar to return to the top of the bucket. Right after connecting, you are already there. Search covers the folder you are viewing and everything below it, so from the top level it covers the whole bucket.
  2. Type at least two letters into the Search files and folders… box.
  3. After a half-second pause, a Search Files notice warns that searches “may consume additional credits”. Tick I understand and don’t show this warning again, then click I Understand. Without the tick, the notice returns before every search and Enter reopens it instead of the full results page. Those credits are your provider’s list requests, not an Opndrive charge.
  4. When up to eight matches appear, press Enter for the full results page, with matches from every folder below. The info icon beside the count shows how many API requests the search made.
  5. For a result inside a folder, select it, then open More actions in the bar at the top and choose Show in folder. Skip the Show in folder on the result’s own row: it currently drops the trailing slash from the folder path. A file at the top level has no folder to jump to.

From there you can open the file without downloading it or share it as an expiring link.

What the search matches and what it misses

Opndrive compares only the last segment of each key, the file or folder’s own name, and ignores case.[11]

You search for What Opndrive shows
invoice, for Invoice-0042.pdf Found: case is ignored
0042, a piece of the name Found: the text can sit anywhere in the name
acme, for clients/acme/2026/invoice-0007.pdf Not that file: folder names in its path are not compared
projects, a folder made with New folder Listed as a folder
team, a folder that has no marker Not listed as a folder; report still finds team/2024/report.txt
Words inside a PDF or CSV Never: names only

The projects and team rows differ because of a folder marker. It is an empty object named projects/ that the S3 console writes when you make a folder[4]. Opndrive’s New folder writes one too, and its search lists a folder only when that object exists[11]. A script that uploads team/2024/report.txt writes no team/ marker.

The search does not sort results, and Opndrive cannot move or copy what you find.

Release v3.1.1 reads more than the main branch

In v3.1.1, a matching folder is searched again (v3.1.1 search code). That reads its files once more per matching folder above them. A search that matches nothing reads everything below the current folder. The main branch fixes both,[12] but on 2026-12-07 no release holds the fix, so the latest image can show a higher request count.

From a terminal: list every key, then grep -i

The AWS CLI is Amazon’s command-line tool. Its aws s3 ls --recursive command prints every key on its own line, not one PRE line per folder[13]. It fetches the 1,000-key pages for you[14]. grep keeps only lines that contain your text, and -i ignores case.

For Cloudflare R2, Backblaze B2 or your own server, give the CLI the provider’s address with --endpoint-url:[13]

Bash
aws s3 ls s3://my-bucket --recursive --endpoint-url https://s3.example.com | grep -i invoice
2026-12-06 21:11:47          4 Invoice-0042.pdf
2026-12-06 21:11:48          4 clients/acme/2026/invoice-0007.pdf
2026-12-06 21:11:48          4 projects/q4/invoice-summary.csv

Lines 1, 2 and 3 differ by server:

Server Line 1 Line 2 Line 3
MinIO 2026-12-06 21:11:47 4 Invoice-0042.pdf 2026-12-06 21:11:48 4 clients/acme/2026/invoice-0007.pdf 2026-12-06 21:11:48 4 projects/q4/invoice-summary.csv
SeaweedFS 2026-12-06 21:11:55 4 Invoice-0042.pdf 2026-12-06 21:11:56 4 clients/acme/2026/invoice-0007.pdf 2026-12-06 21:11:56 4 projects/q4/invoice-summary.csv
Garage 2026-12-06 21:12:04 4 Invoice-0042.pdf 2026-12-06 21:12:04 4 clients/acme/2026/invoice-0007.pdf 2026-12-06 21:12:05 4 projects/q4/invoice-summary.csv
RustFS 2026-12-06 21:12:12 4 Invoice-0042.pdf 2026-12-06 21:12:13 4 clients/acme/2026/invoice-0007.pdf 2026-12-06 21:12:13 4 projects/q4/invoice-summary.csv

We ran this on four S3 servers. In our run, only the date and time differed between MinIO, SeaweedFS, Garage and RustFS: they show when our setup uploaded each file. The size and the full key matched on every server. Each line ends with the full key, which tells you the folder. Because grep reads the whole key, grep -i acme lists every file under clients/acme/.

Adding | cut -c 32- after the grep drops the date and size. The CLI pads sizes to 10 characters, so that cut lands wrong once a file reaches 10,000,000,000 bytes.[15]

Why not filter with –query

The other common answer filters with --query and contains(). We ran it on the same bucket:

Bash
aws s3api list-objects-v2 --bucket my-bucket --query "Contents[?contains(Key, 'invoice')].Key" --output text
clients/acme/2026/invoice-0007.pdf  projects/q4/invoice-summary.csv

Look for Invoice-0042.pdf in the output: contains() matches letters exactly as typed. The filter also runs on your computer after every page arrives, so it saves no list requests.[16]

MinIO’s mc find filters listings with --name, a prefix with limited wildcards, or --regex, an RE2 regular expression: add (?i) to ignore case. MinIO tests mc with MinIO AIStor and AWS S3 and gives no guarantees for other S3-compatible servers.[17]

A follow-up post covers what a search costs, millions of files, text inside files and per-user access.

References

  1. Organizing objects in the Amazon S3 console by using folders
  2. Organizing objects using prefixes
  3. Download the SageMaker Debugger profiling report
  4. Naming Amazon S3 objects
  5. Objects, Cloudflare R2 docs
  6. S3 List Objects V2, Backblaze
  7. Opndrive release workflow
  8. Opndrive release v3.1.1
  9. Connecting Your Storage, Opndrive docs
  10. Configure CORS, Opndrive docs
  11. Opndrive search code
  12. Opndrive search fix, pending changeset
  13. ls, AWS CLI Command Reference
  14. Pagination in the AWS CLI
  15. aws-cli subcommands.py
  16. Filtering output in the AWS CLI
  17. mc find, MinIO docs

Try Opndrive

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

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