Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I understand that there are approx. 64K possible files in a FAT32 folder. This assumes 8.3 file names. Longer file names take up multiple slots. Therefore, it is difficult to know how many actual directory entries are being used.

I've encountered this limit once in a while because of long file names, not sheer number of files. Is there a way for us to know the actual number of free file-directory spaces in a folder?

share|improve this question

I know of no tool that will let you count the number of directory catalog entry "slots" in use or available in a FAT32 folder. A nice gentleman named Udi Cohen has a C++ utility for sorting filenames in fat32, and you may be able to define a class that that will let you enumerate or get a count of these entries

The limitation is set by the file system. FAT32 can have 65,536 entries. Each file and subdirectory takes from two to thirteen entries, depending on the length of its name.

The FAT32 spec is available here:

It gives details on everything, including the directory structure and the way Long File Names (LFNs) are stored in directories.

Basically, there's one directory entry that always holds the short (8.3) version of the file name. If the actual name doesn't fit that mold, then there will be one to twelve more entries, each of which holds 13 bytes of the full name. So a file named "veryverylongname.txt" would take three entries. The first would have the short name, something like "veryve~1.txt", the second would have "veryverylongn", and the third would have "ame.txt".

share|improve this answer
Thank you! Using this information, it should be possible to write a program in Perl or the like, that just reads a directory listing and calculates the number of entries used from the lengths of the file names. No need to go low-level. – Paul Emmons Apr 21 '13 at 23:20
How does this look:#input from dir /b while ($ln=<>) { chop $ln; $nfiles++; $dot=""; $base=""; $ext=""; $ln =~ /([^.]*)(\.)(.*)/; $base = $1; $dot=$2; $ext=$3; $baselen=length($base); $extlen=length($ext); if ($baselen > 8 || $extlen > 3 || $ext =~ /\./) { $totlen=$baselen+$extlen+length($dot); $nent+=int($totlen/13); $nent++ if ($totlen%13 > 0); } } $nent+=$nfiles; $rem=65536-$nent; print "$nfiles file names occupy $nent directory entries. $rem entries remain."; – Paul Emmons Apr 22 '13 at 3:05

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.