Re: Finding a File
| From: | Mark | Date: | Fri, 21 Sep 2001 21:29:24 +0000 |
| Subject: | Re: Finding a File | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-68218@lists.php.net to get a copy of this message | ||
On Fri, 21 Sep 2001 15:29:34 -0500, Joseph Koenig wrote:
>Hello everyone -- I'm just a little bit stumped on this. I've got
>some
>files that are available for user download, however, the files are
in
>different directories. The file names are based on the item number
>which
>is available. For example, item number "AS1000-01" is in directory
>"AS"
>and is named "AS1000-01.xxx" -- All files will have the same
>extension.
>That's no problem. Where I'm confused is not all of the directories
>are
>2 letter names. For example, file "BSEB10-010" is in the "BSE"
>directory. Some directories are 4 characters long -- all except the
>BSEB**-*** files match their directory names until the file name
>contains a number (ASxxxx is in "AS", MASxxxx is in "MAS", etc). I
>need
>this script to be as dynamic as possible. I don't want to set up
>arrays
>of directory names or anything. Can I run through the string of item
>numbers until I hit a numeric character, and then check that
>substring
>to see if it's a directory? If it doesn't match exactly is there a
>way
>to search for that file in directories that almost match? Any ideas?
how about:
$path=
find /$basedir -name $filename;