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.
Edit:
The FAT32 spec is available here:
http://www.microsoft.com/whdc/system/platform/firmware/fatgen.mspx
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.
Edit #2:
I did some testing in a VM with Windows XP and a FAT32 drive (with the recycle bin at maximum).
In a data
directory i created a sub-directory test
after which i run this batch-file:
@echo off
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
goto EOF
:####
echo %2%3%4%5
echo test > test\%2%3%4%5
:EOF
Resulting in 65534 files (only with short-names).
As expected it couldn't add the last two files (FFFE
and FFFF
) because of the 2 directory entries (.
and ..
). So .
and ..
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 De1
, De2
etc. these are long filenames (because of the mixed case). Explorer gave an error after deleting 32765 files.
The dir /a/x
gave me 32767 files and 2 directories.
32765 user files (with LFN), an INFO2
and 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 De1
, 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 INFO2
.
Edit #3:
I just confirmed that the delete mechanism of Windows does need an extra directory entry.
I did 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 e:\test
. Creating 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 .
and ..
= 65534 entries.
and for the recycle bin it is 65536 -2 for .
and ..
and -2 for desktop.ini
and INFO2
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).
Best Answer
First, if the drive is optimized for quick removal, as in USB flash drives, no Recycle Bin is shown. Check Better performance, and probably enable write caching, for an external HDD or SSD.
Second, very large files or files that added to existing trash would exceed the size set for the Recycle Bin cannot be recycled. Set the maximum size of the bin appropriately. Even so, Windows may warn you a file is too large for the bin.
Third, as you mentioned, "Don't move files to the Recycle Bin..." should not be selected for the external USB drive. This setting is per drive.