468,289 Members | 1,867 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,289 developers. It's quick & easy.

recursive file search

I'am new to php and have a question about a recursive file search.
I'd like to do a recursive search for jpg-files and add the filenames (full
path) to a mysql database.
I appreciate any help !

Regards,

Robertico
Oct 28 '06 #1
3 2032
Robertico wrote:
I'am new to php and have a question about a recursive file search.
I'd like to do a recursive search for jpg-files and add the filenames (full
path) to a mysql database.
I appreciate any help !

Regards,

Robertico

For a start, check out these functions:

http://www.php.net/manual/en/function.opendir.php
http://www.php.net/manual/en/function.readdir.php
http://www.php.net/manual/en/function.closedir.php

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Oct 28 '06 #2
Robertico schrieb:
I'am new to php and have a question about a recursive file search.
I'd like to do a recursive search for jpg-files and add the filenames (full
path) to a mysql database.
I appreciate any help !

Regards,

Robertico

Hi Robertico,

it's quite easy *g*
I'll give you the keywords:

loop, array, dir (http://ch2.php.net/manual/en/class.dir.php),
is_dir() (http://ch2.php.net/is_dir)

Try it out!
If you need more support just send me an email (jmattes {at} student
{dot} ethz {dot} ch)

But try to solve it yourself before sending me an email.

Greets Jochen
Oct 28 '06 #3

Robertico wrote:
I'am new to php and have a question about a recursive file search.
I'd like to do a recursive search for jpg-files and add the filenames (full
path) to a mysql database.
I appreciate any help !

Regards,

Robertico
I went ahead and wrote a couple different scripts to do this because I
found it an interesting topic. Yes recursive php directory searches can
do what you want, but they're too resource intensive when you're just
looking for filenames. You can accomplish this very fast using the
"find" shell command, as long as you can run "shell_exec()" in php.

http://www.ss64.com/bash/find.html
**************
SCRIPT OUTPUT:

There were a total of 889 jpg files found

Executed file search in 0.073278903961182 seconds
Generated SQL INSERT script with mysql_escape_string in
0.19165515899658 seconds
Executed search and generated SQL INSERT script with
mysql_escape_string in 0.26493406295776 seconds
**************

The protocol around here seems to be only offering *hints* at first, so
I don't want to make anyone mad. I'm willing to share if you get
totally stumped though.

Oct 29 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Stian Søiland | last post: by
6 posts views Thread by Talin | last post: by
8 posts views Thread by pietlinden | last post: by
10 posts views Thread by AsheeG87 | last post: by
9 posts views Thread by Lloyd Sheen | last post: by
5 posts views Thread by Jean-Paul Calderone | last post: by
reply views Thread by Simon Brunning | last post: by
2 posts views Thread by MrBee | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.