Files or folders?

Ye' old general discussion board. Basically, for everything that isn't covered elsewhere. Come here to shoot the breeze, shoot your mouth off, or whatever suits your fancy.
This forum is not for asking programming related questions.

Moderator: General Moderators

Post Reply
jabbaonthedais
Forum Contributor
Posts: 127
Joined: Wed Aug 18, 2004 12:08 pm

Files or folders?

Post 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?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

break them into folders in 100 or so blocks.
jabbaonthedais
Forum Contributor
Posts: 127
Joined: Wed Aug 18, 2004 12:08 pm

Post 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.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post 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.
Grim...
DevNet Resident
Posts: 1445
Joined: Tue May 18, 2004 5:32 am
Location: London, UK

Post 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.
jabbaonthedais
Forum Contributor
Posts: 127
Joined: Wed Aug 18, 2004 12:08 pm

Post 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.
Post Reply