Skip to content

Commit e17d1ba

Browse files
committed
docs: add Search Patterns section to file storage guide
Addresses issue #273 by documenting wildcard syntax for GetFileListAsync, GetPagedFileListAsync, and DeleteFilesAsync. Clarifies that patterns use wildcard matching (* and ?), not regex, and that * matches across directory separators enabling recursive searches. Includes pattern reference table and practical examples.
1 parent f454190 commit e17d1ba

1 file changed

Lines changed: 36 additions & 0 deletions

File tree

docs/guide/storage.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,42 @@ do
258258
} while (await result.NextPageAsync());
259259
```
260260

261+
### Search Patterns
262+
263+
The `searchPattern` parameter in `GetFileListAsync`, `GetPagedFileListAsync`, and `DeleteFilesAsync` uses **wildcard syntax** — not regex.
264+
265+
Supported wildcards:
266+
267+
- `*` — matches any sequence of characters, including directory separators (making searches recursive by default)
268+
- `?` — matches any single character
269+
270+
Both `/` and `\` are accepted as path separators and are normalized internally.
271+
272+
| Pattern | Matches |
273+
|---|---|
274+
| `null` or omitted | all files |
275+
| `*` | all files (explicit) |
276+
| `archived/*` | all files under `archived/` at any depth |
277+
| `archived/*.txt` | `.txt` files under `archived/` |
278+
| `*.json` | all JSON files at any depth |
279+
| `*report*` | any file containing "report" in the path |
280+
| `logs/2024/*/*` | files exactly two levels deep under `logs/2024/` |
281+
| `path/to/file.txt` | exact path match |
282+
283+
```csharp
284+
// All files
285+
var all = await storage.GetFileListAsync();
286+
287+
// All files under a directory (recursive)
288+
var archived = await storage.GetFileListAsync("archived/*");
289+
290+
// Only .json files anywhere in storage
291+
var jsonFiles = await storage.GetFileListAsync("*.json");
292+
293+
// Files matching a mid-path wildcard
294+
var reports = await storage.GetFileListAsync("reports/2024/*/summary.pdf");
295+
```
296+
261297
## Stream Modes
262298

263299
Control how file streams are opened:

0 commit comments

Comments
 (0)