Searching & scaning files in directories ?

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
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 !


Re: Searching & scaning files in directories ?

Quoted text here. Click to load it

Extremely slow.

Yes, search manual for 'dir'. Slow.

Quoted text here. Click to load it

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( );}

Re: Searching & scaning files in directories ?

Quoted text here. Click to load it

Slower most likely.

Quoted text here. Click to load it

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.

Quoted text here. Click to load it

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.

Site Timeline