A few millions of sub-directories....

Discussion in 'Programming' started by redhits, Aug 28, 2007.

  1. #1
    do you think that if i will have 1 millions directories in a directory will make that directory very hardly accessible?!
    Like if i will query a file like db/name/file.txt it wil take lot of time to open that file?!
    or i should create subdirectories like db/n/a/m/e/file.txt ?!
     
    redhits, Aug 28, 2007 IP
  2. sarahk

    sarahk iTamer Staff

    Messages:
    28,842
    Likes Received:
    4,543
    Best Answers:
    123
    Trophy Points:
    665
    #2
    You should be fine. Either structure will work - your bigger problem will be how you manage the content.

    Should some of this be in a database, perhaps?
     
    sarahk, Aug 28, 2007 IP
  3. mckST

    mckST Banned

    Messages:
    159
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #3
    sarahk got it perfect... also it will be extremely hard to manage all the content that is inside there.

    Why use databases? maybe use mod_rewrite to create virtual driectorys?

    and keep everything in one folder?

    Would make more sense to me

    mckST
     
    mckST, Aug 29, 2007 IP
    sarahk likes this.
  4. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #4
    If you plan to access these folders via your FTP client, you or your server may get problems, because the FTP client would have to download the directory list, which also includes writing/access permissions and last modification dates. Now if the server has to check a few millions of folders for all these details, and the FTP has to download this huge list, you could get in trouble. On both sides.

    Follow the suggestions above, if possible. And use a database or mod_rewrite. Or structure your folders in a way that they are not all (few millions) in the same directory.
     
    nico_swd, Aug 29, 2007 IP
  5. ssanders82

    ssanders82 Peon

    Messages:
    77
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #5
    I wouldn't put a million directories in a subdirectory, for the reasons above. If you *must* have all them in flat files, use your "db/n/a/m/e/file.txt" structure.
     
    ssanders82, Aug 29, 2007 IP
  6. redhits

    redhits Notable Member

    Messages:
    3,023
    Likes Received:
    277
    Best Answers:
    0
    Trophy Points:
    255
    #6
    yes but 1 questin ...
    if i will have 1 millions directories in a sub directory, won't this make them hard to be accessed? windows and linux store all directories/files into a VFAT. I known they use some graph tehniques...
    The whole directory structures of your hard disk it's an genetic tree.
    So won't this create any problem? like if 1 millions subdirectories,won't take a lot of time to process the names,etc... if you do a cd ...
     
    redhits, Aug 29, 2007 IP
  7. sarahk

    sarahk iTamer Staff

    Messages:
    28,842
    Likes Received:
    4,543
    Best Answers:
    123
    Trophy Points:
    665
    #7
    Potentially... but compared to the management issues it'll be nothing.

    Consider the points above especially
    * ftp access
    * managing the local copy on your windows pc
    * alternatives using database and mod_rewrite
    * security flaws when you set something wrong...

    perhaps you need to spell out the business problem you are trying to solve so we can understand better.
     
    sarahk, Aug 29, 2007 IP