Page 1 of 1

Files or folders?

Posted: Sun Aug 27, 2006 12:07 pm
by jabbaonthedais
I have a product list with hundreds of products, and thousands of images (around 2,500), and the list is growing. I had all the images in one folder, numbered 1.jpg to 2500.jpg. When I open the folder in any FTP client it only shows me 1998 files (I guess the max) so I have to delete files to see more. I imagine this is really slow for the server. Would it be better to break them down into sub folders?

Like this:
/products/1/1.jpg - 1000.jpg
and
/products/2/1001.jpg - 2000.jpg

I'm looking for the fastest/best option for server load. I need to pull these images often on my site, but not all at the same time (obviously). Anyone know the best solution?

Posted: Sun Aug 27, 2006 1:53 pm
by feyd
break them into folders in 100 or so blocks.

Posted: Sun Aug 27, 2006 3:21 pm
by jabbaonthedais
Thats feyd! I wonder how many folders I can have before I start getting server problems... lol.... I had 3k folders one time and accessing that (via ftp at least) gave me hell. But I'm not sure how the server handles it when I'm just pulling a single file.

Posted: Sun Aug 27, 2006 3:37 pm
by feyd
As long as the server isn't pulling a list, I have yet to see one slow because of a few nested folders. As an example, I have multiple levels (I think four) of folders in one thing I've built. So they're all separated out, nice and tidy. It works without any issue.

Consider this: internally reference them as say 01234567.jpg. You could store that file at /01/23/45/67.jpg or /01/23/45/01234567.jpg.

Posted: Tue Aug 29, 2006 8:59 am
by Grim...
Do you really have to FTP to them?
As long as the server isn't called to display all the files at once (which it is when you FTP to it) the server doesn't care how many files are in one folder.

Posted: Tue Aug 29, 2006 9:33 am
by jabbaonthedais
Grim... wrote:Do you really have to FTP to them?
As long as the server isn't called to display all the files at once (which it is when you FTP to it) the server doesn't care how many files are in one folder.
Normally I don't have to FTP to them. In fact, I had it setup this way for 6 months. The only time I ran into a problem was when I changed to a new server and had to backup everything and upload to the new server. I had to delete 1,000 files, download 1,000, delete and repeat until I had them all.