---
name: "SDL_GlobStorageDirectory"
section: "3"
platform: "linux"
package: "libsdl3-doc"
version: "3.2.10+ds-1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/SDL_GlobStorageDirectory"
---

# SDL\_GlobStorageDirectory(3)

Enumerate a directory tree, filtered by pattern, and return a list.

## NAME

SDL\_GlobStorageDirectory - Enumerate a directory tree, filtered by pattern, and return a list.

## HEADER FILE

Defined in SDL3/SDL\_storage.h

## SYNOPSIS

```
#include "SDL3/SDL.h"
```

**char \*\* SDL\_GlobStorageDirectory(SDL\_Storage \*storage, const char \*path, const char \*pattern, SDL\_GlobFlags flags, int \*count);**

## DESCRIPTION

Files are filtered out if they don't match the string in **pattern** , which may contain wildcard characters *(match everything) and* **?** (match one character). If pattern is NULL, no filtering is done and all results are returned. Subdirectories are permitted, and are specified with a path separator of '/'. Wildcard characters and **?** never match a path separator. **flags** may be set to  **SDL\_GLOB\_CASEINSENSITIVE**

to make the pattern matching case-insensitive.

The returned array is always NULL-terminated, for your iterating convenience, but if **count** is non-NULL, on return it will contain the number of items in the array, not counting the NULL terminator.

If **path** is NULL, this is treated as a request to enumerate the root of the storage container's tree. An empty string also works for this.

## FUNCTION PARAMETERS

- *storage*

  a storage container.

- *path*

  the path of the directory to enumerate, or NULL for the root.

- *pattern*

  the pattern that files in the directory must match. Can be NULL.

- *flags*

  **SDL\_GLOB\_\*** bitflags that affect this search.

- *count*

  on return, will be set to the number of items in the returned array. Can be NULL.

## RETURN VALUE

(char *) Returns an array of strings on success or NULL on failure; call*

**SDL\_GetError** () for more information. The caller should pass the returned pointer to  **SDL\_free**\
  when done with it. This is a single allocation that should be freed with  **SDL\_free** () when it is no longer needed.

## THREAD SAFETY

It is safe to call this function from any thread, assuming the **storage** object is thread-safe.

## AVAILABILITY

This function is available since SDL 3.2.0.
