A FAT32 directory can have 65,536 directory entries.
Each file and subdirectory takes from two to thirteen entries, depending on the length of its name.
So in the most optimistic situation your recycle bin could hold 65,536 /2 = 32768 files+directories if they all have filenames in the 8.3 range. (Short names)
Your 31594 files + 53 directories seem to hit the limit.
There are probably a few files that take >2 entries due to longer filenames.
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. And because Windows need case sensitivity for the Long File Names (LFNs) it takes a separate directory entry for the LFNs (or muliple if they are longer than 13 characters).
In order to meet the goals of locality-of-access and transparency, the long directory entry is defined as a short directory entry with a special attribute.
I did some testing in a VM with Windows XP and a FAT32 drive (with the recycle bin at maximum).
data directory i created a sub-directory
test after which i run this batch-file:
if "%1"=="####" goto %1
for %%a in (0 1 2 3 4 5 6 7 8 9 A B C D E F) do call %0 #%1 %2 %3 %4 %%a
echo test > test\%2%3%4%5
Resulting in 65534 files (only with short-names).
As expected it couldn't add the last two files (
FFFF) because of the 2 directory entries (
.. only take 2 entries, good to know for later)
Next i selected 45000+ files and deleted these in explorer
(took a while to collect the info before deleting :)
Because the filenames in the recycle bin are
De2 etc. these are long filenames (because of the mixed case). Explorer gave an error after deleting 32765 files.
dir /a/x gave me 32767 files and 2 directories.
32765 user files (with LFN), an
desktop.ini (both without LFN).
(32765 * 2) = 65530 + 2 (without LFN) + 2 directory entries = 65534
Mmmm, still 2 short ;)
With 65534 it should be able to add 1 (with LFN) more. So i think Windows might need an extra free entry for some temporary file.
But as you can see the limit is 65530 directory entries of which each file takes up 2.
(So 32765 files because the resulting filenames are mixed case and even less if the extension is larger then 3).
When i tested this the filenames were all
De2 etc... (the originals where all files without extension) Your filenames have extensions. If they have longer extensions (>3) it could take more entries because Windows does preserve the extension in the recycle bin.
But it is indeed strange Microsoft didn't opt for only short-names in the recycle bin because the (original) filenames should be stored in
I just confirmed that the delete mechanism of Windows does need an extra directory entry.
xcopy e:\recycled\*.* e:\test\ /e/s/h with a full recycle bin, copying all files (32767 files) out of the recycle bin to a test directory.
I could still create 1 file
De_test1.txt (LFN) in
De_test2.txt gave an error.
So "Windows delete" should have had enough to create 1 more (LFN) file but because of something internal it can't.
So for normal folders the limit is 65536 -2 for
.. = 65534 entries.
and for the recycle bin it is 65536 -2 for
.. and -2 for
and -2 for a temp.file (?) = 65530 entries
and with 65530 entries it is a maximum of 32765 files (and less if extensions are >3).