Connecting Tech Pros Worldwide Forums | Help | Site Map

fnmatch() is not working ...

Ruby Tuesdays
Guest
 
Posts: n/a
#1: Jul 17 '05
in win32 installation... is it compiled with it or this is a missing
features? Thanks



Pedro Graca
Guest
 
Posts: n/a
#2: Jul 17 '05

re: fnmatch() is not working ...


Ruby Tuesdays wrote:[color=blue]
> in win32 installation... is it compiled with it or this is a missing
> features? Thanks[/color]

http://www.php.net/fnmatch

<quote>
*Warning*

For now this function is not available on Windows or other non-POSIX
compliant systems.
</quote>
--
--= my mail box only accepts =--
--= Content-Type: text/plain =--
--= Size below 10001 bytes =--
Ruby Tuesdays
Guest
 
Posts: n/a
#3: Jul 17 '05

re: fnmatch() is not working ...


Thanks Pedro, what's the alternative?

imagename can be of the following:

A.bmp
A.tiff
A dark.tif
A lite.bmp
AB.jpg
AB.tif
BB.bmp
BB.jpg
BB.png
BB topleft.png
BB topleft.jpg
GA.png
GA cropped.gif
GA cropped.jpg
BB lowerright.jpg
BB lowerright.gif
etc...

If I know full/partial name(First of 1-2 characters) of the image name, and
the type could be in the following(1st one is the highest priority): png,
jpg, bmp, tif, gif

if exist <fullname>.png then display image
else if exist <fullname>.jpg then display image
else if exist <fullname>.bmp then display image
else if exist <fullname>.tif then display image
else if exist <fullname>.gif then display image
else if exist <first match of partial name>.png then display image
else if exist <first match of partial name>.jpg then display image
else if exist <first match of partial name>.bmp then display image
else if exist <first match of partial name>.tif then display image
else if exist <first match of partial name>.gif then display image
else display no-image.jpg

How do I search a directory efficiently(sub-folder search would be nice but
not necessary for now).

Thanks.


"Pedro Graca" <hexkid@hotpop.com> wrote in message
news:c2qkv0$215ia5$2@ID-203069.news.uni-berlin.de...[color=blue]
> Ruby Tuesdays wrote:[color=green]
> > in win32 installation... is it compiled with it or this is a missing
> > features? Thanks[/color]
>
> http://www.php.net/fnmatch
>
> <quote>
> *Warning*
>
> For now this function is not available on Windows or other non-POSIX
> compliant systems.
> </quote>
> --
> --= my mail box only accepts =--
> --= Content-Type: text/plain =--
> --= Size below 10001 bytes =--[/color]


Pedro Graca
Guest
 
Posts: n/a
#4: Jul 17 '05

re: fnmatch() is not working ...


[Please do not top post]
Ruby Tuesdays top-posted (corrected):[color=blue]
> "Pedro Graca" <hexkid@hotpop.com> wrote in message
> news:c2qkv0$215ia5$2@ID-203069.news.uni-berlin.de...[color=green]
>> Ruby Tuesdays wrote:[color=darkred]
>> > in win32 installation... is it compiled with it or this is a missing
>> > features? Thanks[/color]
>>
>> http://www.php.net/fnmatch[/color][/color]
[color=blue]
> Thanks Pedro, what's the alternative?[/color]

One of the function on the fnmatch() manual page might do what you want.
Or, at least, get you started with a solution.

If you run into problems, post the code you made so far.
--
--= my mail box only accepts =--
--= Content-Type: text/plain =--
--= Size below 10001 bytes =--
Ruby Tuesdays
Guest
 
Posts: n/a
#5: Jul 17 '05

re: fnmatch() is not working ...


Thanks again Pedro.

I try to get the example in the manual to work, but no luck. As you said, it
might not be implemented during the compilation....BTW: I'm using the Win32
version.

Perhaps you know other alternative. Thanks

"Pedro Graca" <hexkid@hotpop.com> wrote in message
news:c2qt9t$1v9cla$1@ID-203069.news.uni-berlin.de...[color=blue]
> [Please do not top post]
> Ruby Tuesdays top-posted (corrected):[color=green]
> > "Pedro Graca" <hexkid@hotpop.com> wrote in message
> > news:c2qkv0$215ia5$2@ID-203069.news.uni-berlin.de...[color=darkred]
> >> Ruby Tuesdays wrote:
> >> > in win32 installation... is it compiled with it or this is a missing
> >> > features? Thanks
> >>
> >> http://www.php.net/fnmatch[/color][/color]
>[color=green]
> > Thanks Pedro, what's the alternative?[/color]
>
> One of the function on the fnmatch() manual page might do what you want.
> Or, at least, get you started with a solution.
>
> If you run into problems, post the code you made so far.
> --
> --= my mail box only accepts =--
> --= Content-Type: text/plain =--
> --= Size below 10001 bytes =--[/color]


Pedro Graca
Guest
 
Posts: n/a
#6: Jul 17 '05

re: fnmatch() is not working ...


[Please do not top post]
Ruby Tuesdays top-posted again (corrected again):[color=blue]
> "Pedro Graca" <hexkid@hotpop.com> wrote in message
> news:c2qt9t$1v9cla$1@ID-203069.news.uni-berlin.de...[color=green]
>> [Please do not top post]
>> Ruby Tuesdays top-posted (corrected):[color=darkred]
>> > what's the alternative?[/color]
>>
>> One of the function on the fnmatch() manual page might do what you want.
>> Or, at least, get you started with a solution.
>>
>> If you run into problems, post the code you made so far.[/color]
>
> I try to get the example in the manual to work, but no luck. As you said, it
> might not be implemented during the compilation....BTW: I'm using the Win32
> version.
>
> Perhaps you know other alternative. Thanks[/color]

The manual hints at glob()
which hints at opendir(), readdir(), closedir()

What did you try with any of these (or other) functions?[color=blue][color=green]
>> If you run into problems, post the code you made so far.[/color][/color]


Please do not top post. It makes threads difficult to follow.
--
--= my mail box only accepts =--
--= Content-Type: text/plain =--
--= Size below 10001 bytes =--
Ruby Tuesdays
Guest
 
Posts: n/a
#7: Jul 17 '05

re: fnmatch() is not working ...


Hi Pedro, I thought I test it first before I did what you suggested.
I can't even get this to work... on win32 binaries. Thanks

<?php
$color = "gray";
if (fnmatch("*gr[ae]y", $color)) {
echo "some form of gray ...";
}
?>


"Pedro Graca" <hexkid@hotpop.com> wrote in message
news:c2t5qa$21lg5e$2@ID-203069.news.uni-berlin.de...[color=blue]
> [Please do not top post]
> Ruby Tuesdays top-posted again (corrected again):[color=green]
> > "Pedro Graca" <hexkid@hotpop.com> wrote in message
> > news:c2qt9t$1v9cla$1@ID-203069.news.uni-berlin.de...[color=darkred]
> >> [Please do not top post]
> >> Ruby Tuesdays top-posted (corrected):
> >> > what's the alternative?
> >>
> >> One of the function on the fnmatch() manual page might do what you[/color][/color][/color]
want.[color=blue][color=green][color=darkred]
> >> Or, at least, get you started with a solution.
> >>
> >> If you run into problems, post the code you made so far.[/color]
> >
> > I try to get the example in the manual to work, but no luck. As you[/color][/color]
said, it[color=blue][color=green]
> > might not be implemented during the compilation....BTW: I'm using the[/color][/color]
Win32[color=blue][color=green]
> > version.
> >
> > Perhaps you know other alternative. Thanks[/color]
>
> The manual hints at glob()
> which hints at opendir(), readdir(), closedir()
>
> What did you try with any of these (or other) functions?[color=green][color=darkred]
> >> If you run into problems, post the code you made so far.[/color][/color]
>
>
> Please do not top post. It makes threads difficult to follow.
> --
> --= my mail box only accepts =--
> --= Content-Type: text/plain =--
> --= Size below 10001 bytes =--[/color]


Pedro Graca
Guest
 
Posts: n/a
#8: Jul 17 '05

re: fnmatch() is not working ...


[top-posting]

http://www.netmeister.org/news/learn2quote2.html

[/top-posting]

Ruby Tuesdays top-posted for the third time
(corrected for the third time):
[color=blue]
> "Pedro Graca" <hexkid@hotpop.com> wrote in message
> news:c2t5qa$21lg5e$2@ID-203069.news.uni-berlin.de...[color=green]
>> [Please do not top post]
>> Ruby Tuesdays top-posted again (corrected again):[color=darkred]
>> > "Pedro Graca" <hexkid@hotpop.com> wrote in message
>> > news:c2qt9t$1v9cla$1@ID-203069.news.uni-berlin.de...
>> >> [Please do not top post]
>> >> Ruby Tuesdays top-posted (corrected):
>> >> > what's the alternative?
>> >>
>> >> One of the function on the fnmatch() manual page might do what you
>> >> want.
>> >> Or, at least, get you started with a solution.
>> >>
>> >> If you run into problems, post the code you made so far.
>> >
>> > I try to get the example in the manual to work, but no luck. As you
>> > said, it might not be implemented during the compilation....
>> > BTW: I'm using the Win32 version.
>> >
>> > Perhaps you know other alternative. Thanks[/color]
>>
>> The manual hints at glob()
>> which hints at opendir(), readdir(), closedir()
>>
>> What did you try with any of these (or other) functions?[color=darkred]
>> >> If you run into problems, post the code you made so far.[/color][/color]
>
> Hi Pedro, I thought I test it first before I did what you suggested.
> I can't even get this to work... on win32 binaries. Thanks
>
><?php
> $color = "gray";
> if (fnmatch("*gr[ae]y", $color)) {
> echo "some form of gray ...";
> }
> ?>[/color]

"Insanity: doing the same thing over and over again and expecting
different results."
~Albert Einstein (1879 - 1955) (attributed)


Applies to both you and me :(
--
--= my mail box only accepts =--
--= Content-Type: text/plain =--
--= Size below 10001 bytes =--
Ruby Tuesdays
Guest
 
Posts: n/a
#9: Jul 17 '05

re: fnmatch() is not working ...



"Pedro Graca" <hexkid@hotpop.com> wrote in message
news:c3299i$23l505$1@ID-203069.news.uni-berlin.de...[color=blue]
> [top-posting]
>
> http://www.netmeister.org/news/learn2quote2.html
>
> [/top-posting]
>
> Ruby Tuesdays top-posted for the third time
> (corrected for the third time):
>[color=green]
> > "Pedro Graca" <hexkid@hotpop.com> wrote in message
> > news:c2t5qa$21lg5e$2@ID-203069.news.uni-berlin.de...[color=darkred]
> >> [Please do not top post]
> >> Ruby Tuesdays top-posted again (corrected again):
> >> > "Pedro Graca" <hexkid@hotpop.com> wrote in message
> >> > news:c2qt9t$1v9cla$1@ID-203069.news.uni-berlin.de...
> >> >> [Please do not top post]
> >> >> Ruby Tuesdays top-posted (corrected):
> >> >> > what's the alternative?
> >> >>
> >> >> One of the function on the fnmatch() manual page might do what you
> >> >> want.
> >> >> Or, at least, get you started with a solution.
> >> >>
> >> >> If you run into problems, post the code you made so far.
> >> >
> >> > I try to get the example in the manual to work, but no luck. As you
> >> > said, it might not be implemented during the compilation....
> >> > BTW: I'm using the Win32 version.
> >> >
> >> > Perhaps you know other alternative. Thanks
> >>
> >> The manual hints at glob()
> >> which hints at opendir(), readdir(), closedir()
> >>
> >> What did you try with any of these (or other) functions?
> >> >> If you run into problems, post the code you made so far.[/color]
> >
> > Hi Pedro, I thought I test it first before I did what you suggested.
> > I can't even get this to work... on win32 binaries. Thanks
> >
> ><?php
> > $color = "gray";
> > if (fnmatch("*gr[ae]y", $color)) {
> > echo "some form of gray ...";
> > }
> > ?>[/color]
>
> "Insanity: doing the same thing over and over again and expecting
> different results."
> ~Albert Einstein (1879 - 1955) (attributed)
>
>
> Applies to both you and me :(
> --
> --= my mail box only accepts =--
> --= Content-Type: text/plain =--
> --= Size below 10001 bytes =--[/color]

Sorry Pedro, I somehow do not understand what top post is. Now I do. Thanks.


Pedro Graca
Guest
 
Posts: n/a
#10: Jul 17 '05

re: fnmatch() is not working ...


Ruby Tuesdays wrote:[color=blue][color=green]
>> Ruby Tuesdays wrote:[color=darkred]
>> > I can't even get this to work... on win32 binaries. Thanks
>> >
>> > <?php
>> > $color = "gray";
>> > if (fnmatch("*gr[ae]y", $color)) {
>> > echo "some form of gray ...";
>> > }
>> > ?>[/color][/color]
>
> Sorry Pedro, I somehow do not understand what top post is. Now I do. Thanks.[/color]

ok, no harm done :)

now ... as the manual ( http://www.php.net/fnmatch ) states the
fnmatch() function is not available on Windows.

You'll do better to forget about that and use glob() or opendir(),
readdir(), ..., closedir().
http://www.php.net/glob
http://www.php.net/opendir


Something like this (not tested):

<?php
$filelist = glob('*gr?y.txt');
echo '<pre>'; print_r(); echo '</pre>';
?>
--
USENET would be a better place if everybody read: : mail address :
http://www.catb.org/~esr/faqs/smart-questions.html : is valid for :
http://www.netmeister.org/news/learn2quote2.html : "text/plain" :
http://www.expita.com/nomime.html : to 10K bytes :
R. Rajesh Jeba Anbiah
Guest
 
Posts: n/a
#11: Jul 17 '05

re: fnmatch() is not working ...


"Ruby Tuesdays" <NoSpamPlease_rubytuzdaiz@yahoo.com> wrote in message news:<c330hr$236bfm$1@ID-205437.news.uni-berlin.de>...[color=blue]
> "Pedro Graca" <hexkid@hotpop.com> wrote in message
> news:c3299i$23l505$1@ID-203069.news.uni-berlin.de...[color=green][color=darkred]
> > > Hi Pedro, I thought I test it first before I did what you suggested.
> > > I can't even get this to work... on win32 binaries. Thanks
> > >
> > ><?php
> > > $color = "gray";
> > > if (fnmatch("*gr[ae]y", $color)) {
> > > echo "some form of gray ...";
> > > }
> > > ?>[/color][/color][/color]

Always, the manual and the user notes are your close friends
<http://in.php.net/fnmatch>

Read the user notes found on the page. It seems to have the
workaround for Windows.

--
"Democracy: Where all citizens are politicians and all politicians
are citizens"
Email: rrjanbiah-at-Y!com
R. Rajesh Jeba Anbiah
Guest
 
Posts: n/a
#12: Jul 17 '05

re: fnmatch() is not working ...


[Top-post fixed. Please don't top-post
<http://www.wikipedia.org/wiki/Top-post> ]



"Ruby Tuesdays" <NoSpamPlease_rubytuzdaiz@yahoo.com> wrote in message news:<c35qdh$20gaik$1@ID-205437.news.uni-berlin.de>...[color=blue]
> "R. Rajesh Jeba Anbiah" <ng4rrjanbiah@rediffmail.com> wrote in message
> news:abc4d8b8.0403150233.15a91e4a@posting.google.c om...[color=green][color=darkred]
> > > > > Hi Pedro, I thought I test it first before I did what you suggested.
> > > > > I can't even get this to work... on win32 binaries. Thanks
> > > > >
> > > > ><?php
> > > > > $color = "gray";
> > > > > if (fnmatch("*gr[ae]y", $color)) {
> > > > > echo "some form of gray ...";
> > > > > }
> > > > > ?>[/color]
> >
> > Always, the manual and the user notes are your close friends
> > <http://in.php.net/fnmatch>
> >
> > Read the user notes found on the page. It seems to have the
> > workaround for Windows.
> >[/color]
> Rajesh,
> As Pedro said, the Win32 distribution does not have fnmatch() function
> compiled in.
>[/color]

If I understand right, you didn't look at the manual
<http://in.php.net/fnmatch> and didn't read the user notes.

_or_ You don't know the meaning of "workaround":
1. http://www.onelook.com/?w=workaround
2. http://www.google.com/search?q=define:workaround

--
http://www.sendmetoindia.com - Send Me to India!
Email: rrjanbiah-at-Y!com
Ruby Tuesdays
Guest
 
Posts: n/a
#13: Jul 17 '05

re: fnmatch() is not working ...


Rajesh,
As Pedro said, the Win32 distribution does not have fnmatch() function
compiled in.


"R. Rajesh Jeba Anbiah" <ng4rrjanbiah@rediffmail.com> wrote in message
news:abc4d8b8.0403150233.15a91e4a@posting.google.c om...[color=blue]
> "Ruby Tuesdays" <NoSpamPlease_rubytuzdaiz@yahoo.com> wrote in message[/color]
news:<c330hr$236bfm$1@ID-205437.news.uni-berlin.de>...[color=blue][color=green]
> > "Pedro Graca" <hexkid@hotpop.com> wrote in message
> > news:c3299i$23l505$1@ID-203069.news.uni-berlin.de...[color=darkred]
> > > > Hi Pedro, I thought I test it first before I did what you suggested.
> > > > I can't even get this to work... on win32 binaries. Thanks
> > > >
> > > ><?php
> > > > $color = "gray";
> > > > if (fnmatch("*gr[ae]y", $color)) {
> > > > echo "some form of gray ...";
> > > > }
> > > > ?>[/color][/color]
>
> Always, the manual and the user notes are your close friends
> <http://in.php.net/fnmatch>
>
> Read the user notes found on the page. It seems to have the
> workaround for Windows.
>
> --
> "Democracy: Where all citizens are politicians and all politicians
> are citizens"
> Email: rrjanbiah-at-Y!com[/color]


Ruby Tuesdays
Guest
 
Posts: n/a
#14: Jul 17 '05

re: fnmatch() is not working ...


Hi Rajesh,
if you really follow the thread, I did mention that it is not available
for Windows. Thanks to Pedro.


Closed Thread