Aggro wrote:
[color=blue]
> Chris Hope wrote:
>[color=green]
>> To get around this, you can have multiple levels of directories based
>> on the first few characters of the filename. So for example if the
>> file is called foo3455.jpg for example, its file location might
>> be /images/f/o/o/foo3455.jpg which should leave you with only a few
>> hundred images in each third level directory, depending on file
>> naming[/color]
>
> Of if filenames are too similar for that, or you are naming the files
> by the application side, you could just give id for each file and name
> the file according to the id (1.jpg, 2.jpg, 3.jpg , etc.) And place
> the files into numbered folders, like this:
>
> 1-1000000
> |- 1-100000
> |- 1-10000
> |- 20001-30000
> |- 30001-40000
> |- ...
> |- 100001-200000
> |- 200001-300000
> |- 300001-400000
> |- ...
> 1000001-2000000
> |- ...
> 2000002-3000000
> |- ...
>
>
> So folder named "1-1000000" would contain all sub folders and files
> that contain images between 1 to 1000000. And sub folder named
> "1-100000" would contain all sub folders and files between 1 to 100000
> etc. The example system would allow you to have exatctly 10000 images
> for each folder, but you could expand it to have for example 100
> images for each folder if you like to. And while this system has only
> 10 sub folders under each folder, you could instead have 100 or more.
> Like this:
>
> 1-1000000
> |- 1-10000
> |- 20001-30000
> |- 30001-40000
> |- ...
> |- 980001-990000
> |- 990001-1000000
> 1000001-2000000
> |- 1000001-1010000
> |- 1020001-1030000
> |- ...
> 2000002-3000000
> |- ...
>
> 10000 might be too much files under each folder, so you might want to
> fix this a little more to something like 1000 sub folders under each
> folder and 1000 images under each folder, or something like that.
>
> Just a suggestion anyway ;)[/color]
Good thinking too. My idea was just really a starting point because it
really all depends on what sort of naming exists for the filenames.
The first time I came across this method of storing data/files was when
I was studying and one of our lecturers was talking about a huge phone
number database. I'm not sure why they didn't just use a relational
database, but for whatever reason they stored the data on the file
system and used a directory structure like eg 1/2/3/5/5/5/7/8/90.dat
where the first three digits were the area code and the rest of them
were the start of the phone number etc.
--
Chris Hope - The Electric Toolbox -
http://www.electrictoolbox.com/