Solved

Multiple wildcard queries for FileInfo.getFiles

Posted on 2004-03-26
3
925 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
  • 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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

IP addresses can be stored in a database in any of several ways.  These ways may vary based on the volume of the data.  I was dealing with quite a large amount of data for user authentication purpose, and needed a way to minimize the storage.   …
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…
As a trusted technology advisor to your customers you are likely getting the daily question of, ‘should I put this in the cloud?’ As customer demands for cloud services increases, companies will see a shift from traditional buying patterns to new…

920 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now