473,385 Members | 1,798 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

directory.getfiles

directory.getfiles(path, "*.htm") finds .htm and .html files
same if you are looking for .c it finds .css also

is there a fuction that just gets the file extention specified?

Oct 6 '06 #1
5 1297
Yes,

http://msdn2.microsoft.com/en-us/library/wz42302f.aspx

Cor

"frogman7" <fr******@googlemail.comschreef in bericht
news:11**********************@h48g2000cwc.googlegr oups.com...
directory.getfiles(path, "*.htm") finds .htm and .html files
same if you are looking for .c it finds .css also

is there a fuction that just gets the file extention specified?

Oct 6 '06 #2
AFter reading the doc it looks like i will have to try a different
approach

i want the user to be able to search for *.htm and only get the files
that have an htm extention not the html files. so i will have to add
some code to see if they only want the htm files and just return
thoses.

if you have any suggestions please let me know

Oct 6 '06 #3
On 5 Oct 2006 21:32:35 -0700, "frogman7" <fr******@googlemail.comwrote:
>AFter reading the doc it looks like i will have to try a different
approach

i want the user to be able to search for *.htm and only get the files
that have an htm extention not the html files. so i will have to add
some code to see if they only want the htm files and just return
thoses.

if you have any suggestions please let me know
One way -
This Mainpages folder contains a mix of files with .htm & .html extensions.

The resulting displayed listbox displays only the files with the .htm extensions.

Dim di As New DirectoryInfo("E:\Web Projects\Mainpages")
Dim fi As FileInfo() = di.GetFiles("*.htm")
For Each fiTemp As FileInfo In fi
If fiTemp.Extension = ".htm" Then
Me.ListBox1.Items.Add(fiTemp.Name)
End If
Next
Gene
Oct 6 '06 #4
what i am trying to do is something similar to the search that windows
does to find files and folders. I am putting a start directory and
want to find all the file (including the files in the sub folders) so i
can write each line to a master file. i have it working but it uses
loops and it extremely slow. Is there a function that grabs all the
files from a folder and subdirecies?

Oct 13 '06 #5

Do it Like this
FileInfo Myfile = new FileInfo(strFiles[i]);
if (Myfile.Extension.Length==4)
{

}

Nov 30 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
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...
2
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...
4
by: Elmo Watson | last post by:
Is there a way, with the System.IO class, to do a recursive list of a directory structure? For instance, in DirectoryInfo, you have GetDirectories and GetFiles .... In Directory, you have...
2
by: OpticTygre | last post by:
I have a directory of 27 files. The files end in either 1.txt, 2.txt, 3.txt, or 4.txt. If I say: For Each filename As String In...
3
by: Michael | last post by:
Hi, I have been using Directory.GetFiles("g://"); in my c# application. But now my boss want's me to do Directory.GetFiles(IP address); I have been unable to figure out how to get this to work....
3
by: cjb | last post by:
Is there a way to get Directory.GetFiles to return multi-language file names? I haven't found any overloads that allow any such parameter. The way I am using it now is: foreach (string d in...
2
by: =?Utf-8?B?RGFuaWVsIENvcnLDqmE=?= | last post by:
Hi, I've been trying to use Directory.GetFiles() and also DirectoryInfo.GetFiles() to list files on a remote server using "\\server_name\dir_name" like paths. It works fine on a test windows...
2
by: Alex | last post by:
Hello, I'm creating a program to parse a directory and all files within that directory (including subdirectories), but 'directoryinfo' only parses the current directory. Is it possible to have...
3
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...
0
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,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
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$) { } ...
0
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...
0
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
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...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
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 using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.