Hi,
I only can get one file type using GetFiles function,
GetFiles(path, "*.txt")
But if i want to get two or more file types, how to do?
Thanks 5 1699
Dim str() as String
str = GetFiles(path, "*.*")
For i = 0 to str.Length -1
If Path.GetExtension(str(i)) = ".txt" or Path.GetExtension(str(i)) =
".doc" then
'--- Do whatever
End if
Next
yxq wrote: Hi, I only can get one file type using GetFiles function,
GetFiles(path, "*.txt")
But if i want to get two or more file types, how to do?
Thanks
"yxq" <ga***@163.net> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl... I only can get one file type using GetFiles function, GetFiles(path, "*.txt") But if i want to get two or more file types, how to do?
Imports System.IO
.. . .
For Each eFile As String In Directory.GetFiles(path, "*.*")
Select Case Path.GetExtension(eFile).ToLower()
Case ".doc", ".txt"
' Do Something
End Select
Next
HTH,
Phill W.
"yxq" <ga***@163.net> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl... I only can get one file type using GetFiles function, GetFiles(path, "*.txt") But if i want to get two or more file types, how to do?
Imports System.IO
.. . .
For Each eFile As String In Directory.GetFiles(path, "*.*")
Select Case Path.GetExtension(eFile).ToLower()
Case ".doc", ".txt"
' Do Something
End Select
Next
HTH,
Phill W.
Thank you
"Phill. W" <P.A.Ward@o-p-e-n-.-a-c-.-u-k> дÈëÓʼþ
news:c4**********@yarrow.open.ac.uk... "yxq" <ga***@163.net> wrote in message news:%2****************@TK2MSFTNGP09.phx.gbl... I only can get one file type using GetFiles function, GetFiles(path, "*.txt") But if i want to get two or more file types, how to do?
Imports System.IO . . . For Each eFile As String In Directory.GetFiles(path, "*.*") Select Case Path.GetExtension(eFile).ToLower() Case ".doc", ".txt" ' Do Something End Select Next
HTH, Phill W.
Thank you
"Phill. W" <P.A.Ward@o-p-e-n-.-a-c-.-u-k> дÈëÓʼþ
news:c4**********@yarrow.open.ac.uk... "yxq" <ga***@163.net> wrote in message news:%2****************@TK2MSFTNGP09.phx.gbl... I only can get one file type using GetFiles function, GetFiles(path, "*.txt") But if i want to get two or more file types, how to do?
Imports System.IO . . . For Each eFile As String In Directory.GetFiles(path, "*.*") Select Case Path.GetExtension(eFile).ToLower() Case ".doc", ".txt" ' Do Something End Select Next
HTH, Phill W.
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Demetri |
last post by:
Using the GetFiles method of the DirectoryInfo instance
one can pass in a search pattern of string type.
For example:
DirectoryInfo di = new DirectoryInfo("C:\temp");
FileInfo fi =...
|
by: S. Han |
last post by:
I'm using Directory.GetFiles to enumerate files in a directory. The problem
is if you have to enumerate all files + subdirectories recursively, it takes
too much memory, and it fails.
Is there...
|
by: John Smith |
last post by:
Hello all:
I am trying to search for more than one extension in a directory at the
same time with the following code:
string files = Directory.GetFiles(sDir, "*.doc*.dot");
However, this...
|
by: philin |
last post by:
Hi:
I am using GetFiles() method of directory class to get
some file names. I want to do know how i can setup search
pattern strings to get multiple file types. Like:
GetFiles(Path,"*.Txt")...
|
by: al jones |
last post by:
I'm using filesystem.getfiles - and so far it's working correctly *however*
I'd sure like to be able to pass it, as the last parameter, the extensions
(plural) for which I'm looking.
I assumed...
|
by: Hawk |
last post by:
I was writing my own wildcard compare algorithm and making a custom GetFiles
routine when I came across what I think is a bug in .net's own GetFiles.
My routine was coming up with different...
|
by: Lance |
last post by:
Hi All,
I'm working on a program that requires searching multiple drives for multiple file types
and cataloging them based on certain geospatial attributes. All together, there are
hundreds of...
|
by: jobs |
last post by:
Say I only have a single file I want to get information on. How can I
adapt this code?
Dim dr As DataRow
Dim fi As FileInfo
Dim dir As New DirectoryInfo(filename)
Dim dt As New DataTable...
|
by: Michael Jackson |
last post by:
In my .NET 2.0 VS 2005 VB application, I'm using Directory.GetFiles(path) to
get all the files in the directory. However, I'm getting an error regarding
"Illegal character in Path", even though I...
|
by: tshad |
last post by:
I am trying to do multiple Directory.GetFiles and append the results to one
array that I will process. I tried this:
string strFiles;
strFiles = Directory.GetFiles(SemaSettings.InputFilePath,...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |