Clear questions and runnable code get the best and fastest answer |
|
PerlMonks |
Re: (OT) should i limit number of files in a directoryby RMGir (Prior) |
on Sep 11, 2008 at 16:13 UTC ( [id://710670]=note: print w/replies, xml ) | Need Help?? |
merlyn's making a good point. This really sounds like a job for a database.
But if you MUST use the filesystem, then yes, you'll definitely need to do something multilevel. Any operations on directories tend to suffer badly when the file count gets high, and "high" in this context is on the order of 10,000's, not millions. I'd strongly suggest NOT doing "op/us/cows" "optimization". If the full filename is in the leaves, a lot of operations get simpler (since you don't need to remember the path to the file). And if your filesystem ever got corrupted, you'd never be able to recover - you might be left with an orphaned directory full of files named "cows","goats",etc... with no way of knowing that they belong under op/us. With full filenames, you can survive "mid-tree" corruption without issues, assuming fsck rescues the orphaned data. Mike
In Section
Seekers of Perl Wisdom
|
|