I am developing some PHP project on the Linux platform. Are there any drawbacks in putting several thousand images (files) in one directory? This is a closed set that will not grow. An alternative would be to split these files using a directory structure based on some identifier (thus, only 100 in one directory could be said).
I ask this question because I often see this separation when I look at the URLs of images on different sites. You can see that the separation of directories is carried out in such a way that no more than several hundred images are in the same directory.
What would I win without putting several thousand files (from a non-growing set) in one directory, but dividing them in groups, for example. one hundred? Is it worth complicating things?
UPDATE:
- There will be no programmatic iteration over the files in the directory (just direct access to the image by file name)
- I want to emphasize that the set of images is closed. These are less than 5000 images, and that’s it.
- Logical categorization of these images does not exist.
- No human access / view required
- Images have unique file names
- OS: Debian / Linux 2.6.26-2-686, File system: ext3
VALUABLE INFORMATION FROM ANSWERS:
Why allocate many files to different directories:
- "Limitation of 32 thousand files for each directory when using ext3 over nfs"
- performance reason (access speed) [but for several thousand files it’s hard to say whether it’s worth it without measurement]
linux filesystems php
Johnm2
source share