File Count Estimator
Estimate the number of files a directory tree will contain based on depth and fan-out.
About File Count Estimator
A directory tree with uniform fan-out forms a geometric structure: each level has fan_out^level directories. Files reside in the leaf directories, so total file count is leaf_directories × files_per_leaf. This estimate helps with inode capacity planning — if the estimated inode count exceeds the filesystem's inode limit, you will run out of inodes before running out of disk space.
Formulas
Total files
total_files = fan_out^(depth-1) × files_per_dir
- f
- fan-out (subdirs per level)
- d
- depth
- n
- files per leaf directory
Total directories
total_dirs = sum(fan_out^i) for i=0 to depth-1
- f
- fan-out
- d
- depth
Worked example
With the default values below, File Count Estimator returns Total Files of 2,500. Change any input above and every figure here is recalculated in your browser.
Inputs used
- Directory Depthaccepts 1–20
- 4
- Subdirectories per Level (fan-out)accepts 1–100
- 5
- Files per Leaf Directoryminimum 0
- 20
Results
- Total Files
- 2,500
- Total Directories
- 156
- Leaf Directories
- 125
- Total Inodes Required
- 2,656
Step by step
- 1Leaf directories= 125
- 2Total directories (all levels)= 156
- 3Total files= 2500
- 4Total inodes needed= 2656
Assumptions and limits
- The result is derived only from the 3 inputs listed above. Anything not among them is not part of the calculation.
- In particular, this calculator does not take inflation, tax, fees or charges or compounding frequency into account.
- Figures are rounded for display to whole numbers, so totals built from several rounded parts can differ slightly from the unrounded arithmetic.
How these calculators are built and tested is described on the Methodology page. If a figure looks wrong, please report it.
Frequently Asked Questions
Why does inode count matter?
Many filesystems (especially ext4) have a fixed inode count set at format time. If you exhaust inodes, no new files can be created even with free disk space — a common issue on mail servers or systems with millions of tiny files.
How do I check available inodes?
Use 'df -i' to see inode usage per filesystem. The IUsed and IFree columns show consumed and remaining inodes respectively.
