I have a project written for Android devices. It generates a large number of files, each day. These are all text files and images. The app uses a database to reference these files.
The app is supposed to clear up these files after a little use (perhaps after a few days), but this process may or may not be working. This is not the subject of this question.
Due to a historic accident, the organization of the files are somewhat naive: everything is in the same directory; a .hidden
directory which contains a zero byte .nomedia
file to prevent the MediaScanner indexing it.
Today, I am seeing an error reported:
java.io.IOException: Cannot create: /sdcard/.hidden/file-4200.html
at java.io.File.createNewFile(File.java:1263)
Regarding the sdcard, I see it has plenty of storage left, but counting
$ cd /Volumes/NO_NAME/.hidden
$ ls | wc -w
9058
Deleting a number of files seems to have allowed the file creation for today to proceed.
Regrettably, I did not try touch
ing a new file to try and reproduce the error on a commandline; I also deleted several hundred files rather than a handful.
However, my question is:
- are there hard limits on filesize or number of files in a directory?
- am I even on the right track here?
Nota Bene:
The SD card is as-is - i.e. I haven't formatted it, so I would guess it would be a FAT-* format.
The FAT-32 format has hard limits of filesize of 2GB (well above the filesizes I am dealing with) and a limit of number of files in the root directory. I am definitely not writing files in the root directory.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…