If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

If I understand the issue, you want to reference a file, you will know the filename, but the extension could be one of a few possibilities. Rather than getting a list of every file, I would be inclined to do it the other way and check the list of extensions. This will presumably be a much shorter list:

I think you'll need to give us some more specific information about what you want to happen.
The script Mindzai posted will print off links to any images in the images/ directory with the name hello.png, hello.gif, hello.jpg or hello.jpeg. That could be modified slightly to fit what you said originally like this:

If you can't be bothered to post more than a few words, at least detailing some things like the actual output of the script and any debugging you've tried, I can't be bothered to help you fix it. Maybe if you show a bit of courtesy to the people going out of their way to help you, you will find people more willing to keep on helping.