By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,903 Members | 2,042 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,903 IT Pros & Developers. It's quick & easy.

Searching & scaning files in directories ?

P: n/a
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

Jul 17 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
1. How fast would this searching method compare to searching in a
database (let's say mysql)?
Extremely slow.
2. Can PHP have any tool to search directories of files? If it does
have a tool, how fast would it be ?
Yes, search manual for 'dir'. Slow.
3. Would someone point to an examples, or hints on how to complete this
task ?


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);}
Jul 17 '05 #2

P: n/a
"John" <jo*******@hotmail.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
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)?
Slower most likely.
2. Can PHP have any tool to search directories of files? If it does
have a tool, how fast would it be ?
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.
3. Would someone point to an examples, or hints on how to complete this
task ?


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.
Jul 17 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.