Peter,

Believe it or not, but this is actually working. I'm on a Mac OS X, which is
linux underneath, so I was hopeful about the command you provided. I ran
this code:

    exec("find /Users/rjohari/Documents/XFER/espi/ -type f -name
3333333333*.vox", $files);
    foreach ($files as $value) {
        echo "$value<br>";
    }

And it listed all the files that began with that provided phone number.
The only problem is, It¹s printing out the path with it too. So what¹s is
giving me is:

/Users/rjohari/Documents/XFER/espi/33333333331123.vox
/Users/rjohari/Documents/XFER/espi/33333333334567.vox

So I have to accomplish two things:

1. I have to eliminate the filepath from the result
2. I need to specify the variable that holds the phone number, (like
$row[ŒPHONE¹]) instead of the actual phone number in the ³exec² command.

Thanks!! Much Appreciated!

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Rahul Sitaram Johari
CEO, Twenty Four Seventy Nine Inc.

W: http://www.rahulsjohari.com
E: [EMAIL PROTECTED]

³I morti non sono piu soli ... The dead are no longer lonely²


On 3/29/07 4:31 PM, "Peter Lauri" <[EMAIL PROTECTED]> wrote:

>> -----Original Message-----
>> From: Rahul Sitaram Johari [mailto:[EMAIL PROTECTED]
>> Sent: Thursday, March 29, 2007 9:12 PM
>> To: PHP
>> Subject: [PHP] Show Filename using Wildcards
>> 
>> Ave,
>> 
>> I have a script where I have to provide a Download Link to a file
>> associated
>> with a record. The common thing between the record & filename is the phone
>> number. But the filenames have dates & other symbols besides the phone
>> number as well. They all do begin with a phone number though.
>> 
>> How can I match a filename with a record using wildcards?
>> For example, let¹s say someone pulls up a record for phone field:
>> 515515515
>> The files associated with this record could be 515515515031307 or
>> 5155155150325T(2).
>> 
>> So you can see the filenames do begin the phone number in the record, but
>> they contain additional chars. What I need is something that can pull up
>> all
>> 515515515*.ext
>> 
>> Can I do this in PHP?
>> 
>> Thanks!
>> 
> 
> [Peter Lauri - DWS Asia]
> 
> Hi,
> 
> Assuming you are on a linux you could try:
> 
> exec("find /the/path/to/the/place/where/you/should/start/searching -type f
> -name 515515515*.ext", $files);
> 
> Then the $files will be an array with the found files matching the search.
> 
> Best regards,
> Peter Lauri
> 
> www.dwsasia.com - company web site
> www.lauri.se - personal web site
> www.carbonfree.org.uk - become Carbon Free
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

Reply via email to