recursive file search

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

    #1

    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


  • Jerry Stuckle

    #2
    Re: recursive file search

    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:





    --
    =============== ===
    Remove the "x" from my email address
    Jerry Stuckle
    JDS Computer Training Corp.
    jstucklex@attgl obal.net
    =============== ===

    Comment

    • Jochen Mattes

      #3
      Re: recursive file search

      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

      Comment

      • pangea33

        #4
        Re: recursive file search


        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.


        **************
        SCRIPT OUTPUT:

        There were a total of 889 jpg files found

        Executed file search in 0.0732789039611 82 seconds
        Generated SQL INSERT script with mysql_escape_st ring in
        0.1916551589965 8 seconds
        Executed search and generated SQL INSERT script with
        mysql_escape_st ring in 0.2649340629577 6 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.

        Comment

        Working...