Solved

Multiple wildcard queries for FileInfo.getFiles

Posted on 2004-03-26
3
928 Views
Last Modified: 2008-01-09
In a strange twist, the FileInfo.getFiles method does not respond well to queries for multiple wildcards, say for all image files (*.bmp, *.jpg, *.gif, ...).

Using multiple wildcards simply returns nothing, which I find pretty strange since I would have expected the object's behavior to be closely tied to Window's native file search.

So is there a quick an easy way to do this, or do I have to do multiple queries for each file extension?
0
Comment
Question by:mannycalaveras
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 28

Accepted Solution

by:
iboutchkine earned 125 total points
ID: 10690016
You can write your file to the list box for example and then loop through the lb to read ieach file and then get info. While writing to the list box you can filter for files that you need (bmp for example)


        Dim FI As New FileInfo(Directory.GetCurrentDirectory & "\" & lst.Text)
0
 
LVL 1

Author Comment

by:mannycalaveras
ID: 10691231
You mean search for all files and filter myself according to each file's extension?

That's a workable option. I don't like searching for file extensions separately since they do not end up being in alphabetical order this way...

I'll check that out. Although I would appreciate a definitive answer on whether or not there is a way integrated in .NET to do it without doing workarounds like that.
0
 
LVL 1

Author Comment

by:mannycalaveras
ID: 10706737
Seems that there isn't a better answer than doing it all manually, I'll just deal with it this way.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A basic question.. “What is the Garbage Collector?” The usual answer given back: “Garbage collector is a background thread run by the CLR for freeing up the memory space used by the objects which are no longer used by the program.” I wondered …
Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question