473,378 Members | 1,555 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

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 2193
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Stian Søiland | last post by:
all examples performed with: Python 2.3+ (#2, Aug 10 2003, 11:09:33) on linux2 (2, 3, 0, 'final', 1) This is a recursive import:
3
by: alanwo | last post by:
For recursive search for files, like http://support.microsoft.com/default.aspx?scid=KB;EN-US;306666, it may lead to "out of stack" error if searching too many files, say millions of files. Do you...
6
by: Talin | last post by:
I've been using generators to implement backtracking search for a while now. Unfortunately, my code is large and complex enough (doing unification on math expressions) that its hard to post a...
8
by: pietlinden | last post by:
Hopefully a stupid question, but it doesn't appear that way. Found an example of a recursive file search, which is exactly what I want, at Randy Birch's site (mvps.vbnet), but VBA is just...
3
by: Ameen | last post by:
I am very new to programming and VB.net, and I wrote the code below, but it seem to go on an infinite loop. Please tell me what I am doing wrong. Private Sub search(ByVal indexstart) Pos1 =...
10
by: AsheeG87 | last post by:
Hello Everyone! I have a linked list and am trying to include a recursive search. However, I am having trouble understanding how I would go about that. I don't quite understand a recursive...
9
by: Lloyd Sheen | last post by:
For all those who don't think that a recursive search of files in folders is a good thing in the Microsoft.VisualBasic.FileIO.FileSystem namespace listen to this. I am reorg my mp3 collection. ...
5
by: Jean-Paul Calderone | last post by:
On Wed, 16 Apr 2008 13:18:22 -0700 (PDT), skanemupp@yahoo.se wrote: Function calls (recursive or otherwise) are more expensive than for loops, so the version that replaces recursion with a loop...
0
by: Simon Brunning | last post by:
2008/7/4 Gerhard Häring <gh@ghaering.de>: glob's not recursive AFAIK. This recipe probably still works under Pythion 3K, though: ...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.