No space left on device

Martin v. Loewis martin at
Wed Feb 20 23:44:02 CET 2002

sag at (Sue Giller) writes:

> I have a program that generates a LOT of small files in a 
> Windows2000 subdirectory.  It is my understanding (often faulty) 
> that there is no limit to the number of files such a subdirectory can 
> contain.  However, I am getting an error when I hit about 21,843 
> files.

What file system? I believe there *is* a limit to the number of files
you can have in a directory on a FAT32 file system. There is also
actually a limit to the number of files you can have in a directory
residing on an NTFS volume, but that is much larger.

IOW, there is no file system in wide use that is without limits.

> I have over 5 G of space on the drive, and the test files are 0 len 
> anyway.  (It still happens if the files are not 0 len)

I think it maxed out the directory size, then.

> I can then create additional files in that directory from within a DOS 
> window, but I cannot rerun my file generator to make even one more 
> file.   So I am wondering if the limit comes from Windows, from 
> Python 'open...' or some other innards of Python.

It should be a Windows limit; Python is passing the request straigth
to Windows. My guess is that there is a maximum directory size,
counting the number of bytes that the directory consumes on disk; I
would not be surprised if this is 2GB on a FAT32 system (or perhaps
4GB). You may need to turn off 8.3 file name generation (ask MSDN for
details), to reduce the space consumed by a single directory entry.
You may also try to use shorter file names.


More information about the Python-list mailing list