Searching & scaning files in directories ?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • John

    Searching & scaning files in directories ?

    Hi everyone !

    This is a first time I post a message here. If I post my message in a
    wrong group. Please ignore it.

    I am trying to build a website which allows users (can be thousands of
    users, supposedly) to upload their files to their designaged
    directories (max 15 files for each user). A super user (can be more
    than one) want to search for a particular file name and also a
    particular textual part of a file of all user's files in all directory.

    My questions are :

    1. How fast would this searching method compare to searching in a
    database (let's say mysql)?

    2. Can PHP have any tool to search directories of files? If it does
    have a tool, how fast would it be ?

    3. Would someone point to an examples, or hints on how to complete this
    task ?

    Any help would be greatly appreciated !!!

    Thank you in advance !

    John

  • porneL

    #2
    Re: Searching & scaning files in directories ?

    [color=blue]
    > 1. How fast would this searching method compare to searching in a
    > database (let's say mysql)?[/color]

    Extremely slow.
    [color=blue]
    > 2. Can PHP have any tool to search directories of files? If it does
    > have a tool, how fast would it be ?[/color]

    Yes, search manual for 'dir'. Slow.
    [color=blue]
    > 3. Would someone point to an examples, or hints on how to complete this
    > task ?[/color]

    upload files to directory stucture, but keep track of it in database.
    don't even think about scanning directories.
    large directory structures can take several seconds to scan,
    and mysql scans such amounts of data in fractions of a second.


    --
    * html {redirect-to: url(http://browsehappy.pl) ;}

    Comment

    • Chung Leong

      #3
      Re: Searching & scaning files in directories ?

      "John" <johnny_ss@hotm ail.com> wrote in message
      news:1104182926 .077051.111310@ f14g2000cwb.goo glegroups.com.. .[color=blue]
      > Hi everyone !
      >
      > This is a first time I post a message here. If I post my message in a
      > wrong group. Please ignore it.
      >
      > I am trying to build a website which allows users (can be thousands of
      > users, supposedly) to upload their files to their designaged
      > directories (max 15 files for each user). A super user (can be more
      > than one) want to search for a particular file name and also a
      > particular textual part of a file of all user's files in all directory.
      >
      > My questions are :
      >
      > 1. How fast would this searching method compare to searching in a
      > database (let's say mysql)?[/color]

      Slower most likely.
      [color=blue]
      > 2. Can PHP have any tool to search directories of files? If it does
      > have a tool, how fast would it be ?[/color]

      The glob() function can do pretty powerful name matching. For example,
      glob("/var/temp/*/hello.txt") would look for hello.txt in any sub folder.
      The trouble with searching the file system is that on Unix, file names are
      case sensitive.
      [color=blue]
      > 3. Would someone point to an examples, or hints on how to complete this
      > task ?[/color]

      Depending on how large the files are and how often they're accessed, you
      might want to consider storing the file contents in the database. Makes
      things easier to manage, as it eliminates the possibility of mismatch
      between the info in the database and what's in the file system.


      Comment

      Working...