Click to See Complete Forum and Search --> : how many files in a dir


frans-jan
02-04-2002, 03:09 PM
Hi,

What is the maximum amount of files that I can let a script make in one directory?

On a linux server.

take or leave a few ;-)

Thanks!

vincente
02-05-2002, 05:45 PM
Is there a limit? :)
Look that up using google or something.

More to the point: does it make any sense to create a directory with tens-of-thousands of files? If you're talking about thousands of files, doesn't that kind of scream 'put me in a database'?

frans-jan
02-05-2002, 06:06 PM
That's the point, I'm getting a load of images OUT of a database with a script..

And I wondered if I could....

The images are making the database fat and ugly to manage...

(large jpg's in a MySQL base)

Thanks anyway!

vincente
02-06-2002, 04:59 AM
Ah, well getting images OUT of a database is a good thing :-)

I suggest you use a scheme like squid uses; create a master directory, with a number of subdirectories, that each have up to 255 subdirectories.

That way you can store X times 255 files.
If you need more you can add more subdirs in the first layer, giving you up to 255*255=65k files.
Need more? add a layer and you can go to 255*255*255=16.5M files and still have only 255 files per dir (very fast)

That will take some fiddling with a script, but you can store the new location of the files in the database so you won't loose track of where the images are.

frans-jan
02-06-2002, 04:26 PM
I will try to master the creating dir section and keep track where files go...

But it sounds like a challenge, the 255 files in a folder is very usable!

Thanks

Frans-Jan