Solved

Multiple wildcard queries for FileInfo.getFiles

Posted on 2004-03-26
3
929 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: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
Come and listen to Percona CEO Peter Zaitsev discuss what’s new in Percona open source software, including Percona Server for MySQL (https://www.percona.com/software/mysql-database/percona-server) and MongoDB (https://www.percona.com/software/mongo-…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

705 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