Searching for a file if I only part of the name

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • laredotornado@zipmail.com

    Searching for a file if I only part of the name

    Hi,

    Using PHP 4.4.4.

    What is the easiest way to return the full path of a file if I know
    the directory it is in and the beginning part of the file (it will
    begin with the word "header")?

    Thanks, - Dave

  • Rik

    #2
    Re: Searching for a file if I only part of the name

    On Fri, 23 Feb 2007 18:17:36 +0100, laredotornado@z ipmail.com
    <laredotornado@ zipmail.comwrot e:
    Hi,
    >
    Using PHP 4.4.4.
    >
    What is the easiest way to return the full path of a file if I know
    the directory it is in and the beginning part of the file (it will
    begin with the word "header")?
    <?php
    $dir = getcwd();
    chdir('/path/to/you/dir');
    $matches = glob('header*') ;
    chdir($dir);
    ?>

    --
    Rik Wasmus

    Comment

    Working...