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 1696
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: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
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: 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: 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...
| |