Open-Awesome
CategoriesAlternativesStacksSelf-HostedExplore
Open-Awesome

© 2026 Open-Awesome. Curated for the developer elite.

TermsPrivacyAboutGitHubRSS
  1. Home
  2. C/C++
  3. tinydir

tinydir

NOASSERTIONC1.2.6

A lightweight, portable C library for reading directories and files across POSIX and Windows systems.

GitHubGitHub
866 stars131 forks0 contributors

What is tinydir?

TinyDir is a lightweight, portable C library for reading directories and enumerating files across different operating systems. It wraps platform-specific APIs like dirent for POSIX and FindFirstFile for Windows, providing a consistent and easy-to-use interface for file system operations in C projects.

Target Audience

C developers who need a simple, cross-platform solution for directory traversal and file enumeration without external dependencies or complex setup.

Value Proposition

Developers choose TinyDir for its minimalism, portability, and ease of integration—it's a single-header library that works on both POSIX and Windows with a straightforward API, making it ideal for embedded systems, games, or tools where lightweight file system access is needed.

Overview

Lightweight, portable and easy to integrate C directory and file reader

Use Cases

Best For

  • Cross-platform C projects requiring directory listing
  • Embedded systems where lightweight file system access is critical
  • Game development for asset loading and directory traversal
  • Command-line tools that need to enumerate files and folders
  • Educational projects teaching file system APIs in C
  • Porting POSIX directory code to Windows or vice versa

Not Ideal For

  • Applications requiring recursive directory traversal without manual implementation
  • Windows projects dealing with extended-length paths beyond 260 characters
  • Systems where directory contents change frequently and race conditions are a concern
  • C++ projects that could leverage more comprehensive libraries like std::filesystem

Pros & Cons

Pros

Cross-Platform Simplicity

Abstracts dirent for POSIX and FindFirstFile for Windows with a unified API, making it easy to write portable C code for both systems.

Lightweight and Portable

Single-header ANSI C (C90) implementation with no external dependencies, ideal for embedded systems or projects minimizing bloat.

Easy Integration

Simple API with functions like tinydir_open and tinydir_readfile, as shown in the example code, requiring minimal setup.

Unicode Support

Supports Windows Unicode when UNICODE and _UNICODE are defined, ensuring compatibility with international file names.

Cons

Path Length Limitations

Windows paths are limited to 260 characters and overall path/filename sizes are constrained, which can fail in deep directory structures.

Race Condition Vulnerability

Has a known bug where reading a directory with changing content can cause race conditions, as admitted in issue #13.

Basic Feature Set

Only provides basic directory reading; lacks advanced features like recursive traversal, file filtering, or metadata access beyond is_dir.

Frequently Asked Questions

Quick Stats

Stars866
Forks131
Contributors0
Open Issues5
Last commit2 years ago
CreatedSince 2013

Tags

#c-library#filesystem#directory#portable#lightweight#c#posix#cross-platform#ansi-c#file-system#single-header#windows#header-only

Built With

A
ANSI C
W
Windows API
P
POSIX

Included in

C/C++70.6k
Auto-fetched 5 hours ago

Related Projects

stbstb

stb single-file public domain libraries for C/C++

Stars33,529
Forks8,045
Last commit17 days ago
{fmt}{fmt}

A modern formatting library

Stars23,466
Forks2,879
Last commit1 day ago
xxHashxxHash

Extremely fast non-cryptographic hash algorithm

Stars11,008
Forks893
Last commit19 days ago
single_file_libssingle_file_libs

List of single-file C/C++ libraries, with emphasis on clause-less licenses.

Stars9,867
Forks647
Last commit2 months ago
Community-curated · Updated weekly · 100% open source

Found a gem we're missing?

Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.

Submit a projectStar on GitHub