On 1/19/07, Shannon -jj Behrens <[EMAIL PROTECTED]> wrote:

On 1/13/07, Bob Ippolito <[EMAIL PROTECTED]> wrote:
> On 1/13/07, Sean Davis <[EMAIL PROTECTED]> wrote:
> > This is slightly off-topic, but I'll ask anyway, in case someone has already
> > done this.
> >
> > I want to make a simple file storage system of file uploads.  However, I
> > would really like to store the files on the filesystem with the original
> > filename.  There is the possibility of two files having the same filename.
> > Have other people thought about a system that makes sense to keep the next
> > from overwriting the first?  My thought is to create a set of directories on
> > the file system, but how can I organize such a set of directories that makes
> > sense?  The files info will be stored in a database, so I can check for the
> > existence of the files before writing a new one.
> >
>
> You can put files in unique directories and maintain their original
> basename. The directory could be named after the database id or a hash
> of the file's contents.

If you end up having directories with thousands or more entries,
remember to pay attention to whether or not your filesystem can handle
it.  ReiserFS and XFS can handle large directories.  Ext3 can only
handle large directories via a patch that's available.

"High Performance MySQL" p. 116.

The obvious way to deal with that limitation is to consolidate the
common prefixes. Instead of using 8 character directories, you can use
several layers of 2 character directories (or whatever suits your
filesystem's needs).

-bob

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to