We help IT Professionals succeed at work.

Problem with 1000+ files per directory on compact flash disks

DataField asked
Last Modified: 2010-04-03

I was wondering if anybody has any information about this issue. I've run into a problem where at around 1,000 files within a directory, no more files can be written out (to the directory in question).  When removing the compact flash and putting it in a SanDisk reader at my PC, there seems to be no problem at all.  This problem has been replicated with a variety of compact flash disks (Type I and II/CF+) and occurs on WinCE .NET v4.1 and v4.2.  The number isn't exact.  Sometimes it is 995.  Another time it will be 1045, 1024, or 998, etc.  But, it does seem to occur frequently @ ~1,000 files.  I haven't found any documented issues of this type, so I would greatly appreciate any information that anybody might have.

I have posted this question before and had gotten a response that I thought had solved the problem.  The response went something like this:

Guidelines are...
FAT16 - 512 files per directory
FAT32 - 65534 files per directory

In any case, I formatted a microdrive as FAT32 and in one directory more than 2,000 files existed without issues, but for the second directory, after the 999th file, the directory in question became corrupted.
If anybody can think of any other possibilities, I sure would appreciate it.

OS: Windows CE .NET (4.1 & 4.2)
Media: Compact flash type I (SanDisk, FujiDisk, Memorex), type II (Hitachi Microdrive)
Board: ARCOM GX1, ARCOM Viper

Again, any help would be greatly appreciated.

Watch Question

With any filesystem, the more files in a single directory, the worse your performance gets (logarithmically, I believe).  When you write a file or a new directory, the filesystem needs to traverse the entire directory to make sure it doesn't already exist.  

It is possible that it's taking so long to perform this traversal after a certain number of files that your operation is timing out, and the error manifests itself as your problem.  I am curious as to the exact error you're getting.

To give you a relative comparison, one could get the same behaviour on a Windows 2000 NTFS volume (disk) at around 80,000 files or so.

Glenn Dekhayser


The error is 112 "There is not enough space on the disk" (ERROR_DISK_FULL)
Needless to say, the disk is not actually full, though...
My question to you is whether you checked the size limit of the files.  Did you check the file size?


I just realized that I haven't checked this question in quite some time.  I solved the problem myself.

FAT16 - 512 files per directory
FAT32 - 65534 files per directory

However, the 8.3 file naming convention must be adhered to.
This one is on us!
(Get your first solution completely free - no credit card required)
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.