Jump to content

Having a lot of folders is OK?


siwelis

Recommended Posts

In consideration of performance:

 

Is having a lot of folders ok? Like 500 in one folder?

 

Or would it be best if broken down into multiple folders for performance factors? Like 100-300 folders per folder?

 

Thank you in advance.

Link to comment
Share on other sites

  • 2 weeks later...

It really depends on your operating system and application needs. Having many nested directories can have adverse affects on your servers ability to maintain a speedy indexing service.

 

More important questions:

 

What's your need to have the application set like this? How are you accessing the data contained in those directories?

 

Can you use a database instead, it sounds like your replicating database functionality manually... but then again you didn't really say much about what the overall goal is.

 

good luck

 

Link to comment
Share on other sites

  • 2 weeks later...

The overall goal is to have images organized. I've made the mistake of being "too organized" before though, and then not being able to find anything!

 

Years ago I heard that it can be harder for a server to find one image in a folder of 100,000 images than finding it in an extra directory which only has 50,000 images in it. However, I don't really know if what "i heard" was true, considering the server would have to spend time finding the extra directory as well.

 

For now, I assume that finding the extra directory would be worth the time if it broke the next significantly larger portion of the search down by 50%. However, if there were only a few files in the following folders, the extra folder depth incurred would be a waste of time.

Link to comment
Share on other sites

  • 2 weeks later...

so it's just about saving images. in that case, i'd suggest keeping them organized with a nested directory structure. One that defines the type of images in the folder.

 

lets use a typical set up for images on a website.

/images ( no images in this dir, just sub directories )

/images/buttons

/images/titles

/images/cars

/images/cars/blue

 

 

How far you go into your nesting is a consideration that you must make. It's easy to keep them all categorized in deep nested sets, but if there's only going to be one image in each directory for the next year or five it's not worth it.

 

 

As for how many you should keep in a directory, again OS is a big factor here... ie using windows will add more overhead. But again, how are you searching for the images? is this just you looking for an image to embed in some html or are you building a script / app that will need access to read and or write images to the filesystem?

 

If it's the later, then look up times can be increased by a single directory with 100k images. A basic reason is most of the time you are going to read the directory files alphanumerically, making requests for 'zanky.jpg' longer then 'apple.jpg' in one directory. you shouldn't notice this difference under normal circumstances, but it is there.

 

 

 

Link to comment
Share on other sites

  • 2 weeks later...
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.