473,327 Members | 1,979 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,327 software developers and data experts.

Iterate through files

Hello. I have program which now searches for one file in a directory,
because file name is hard-coded. What I wish to do is to have program go to
first file in directory, do some processing, then go to next file in same
directory, do some processing, ect, ect. It seems to me this would be a loop
of some kind. I am researching System.IO and examples perform actions based
upon only one file. Any info is helpful. I am using VS 2005. thank u

Toco
Apr 20 '06 #1
3 5042
Toco wrote:
Hello. I have program which now searches for one file in a directory,
because file name is hard-coded. What I wish to do is to have program go to
first file in directory, do some processing, then go to next file in same
directory, do some processing, ect, ect. It seems to me this would be a loop
of some kind. I am researching System.IO and examples perform actions based
upon only one file. Any info is helpful. I am using VS 2005. thank u

Toco


Have a look at the Directory.GetFiles(path) function. It returns a
string[] with all the files in the specified path.

hth,
Max
Apr 20 '06 #2
Thanks that got me what I needed....

"Markus Stoeger" wrote:
Toco wrote:
Hello. I have program which now searches for one file in a directory,
because file name is hard-coded. What I wish to do is to have program go to
first file in directory, do some processing, then go to next file in same
directory, do some processing, ect, ect. It seems to me this would be a loop
of some kind. I am researching System.IO and examples perform actions based
upon only one file. Any info is helpful. I am using VS 2005. thank u

Toco


Have a look at the Directory.GetFiles(path) function. It returns a
string[] with all the files in the specified path.

hth,
Max

Apr 20 '06 #3
Toco,

You should look up the concept of recursion
http://www.codeproject.com/csharp/recursionincsharp.asp
--
Regards

John Timney
Microsoft MVP

"Toco" <To**@discussions.microsoft.com> wrote in message
news:F8**********************************@microsof t.com...
Hello. I have program which now searches for one file in a directory,
because file name is hard-coded. What I wish to do is to have program go
to
first file in directory, do some processing, then go to next file in same
directory, do some processing, ect, ect. It seems to me this would be a
loop
of some kind. I am researching System.IO and examples perform actions
based
upon only one file. Any info is helpful. I am using VS 2005. thank u

Toco

Apr 20 '06 #4

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

Similar topics

0
by: Marcelo Rizzo | last post by:
I am trying to get the name of a file with a specific extension (tmw) from several different directories. The problem I am having is that the program stops working on the second pass with an run...
4
by: Randall Smith | last post by:
In the case I know how may times I want to iterate, one way to do it is like this: for i in range(100000): dothis() I like how clean this syntax is, but this method is very wasteful. The...
4
by: Julian Yap | last post by:
Hi all, I'm trying to get some ideas on the best way to do this. In this particular coding snippet, I was thinking of creating a dictionary of file objects and file names. These would be...
16
by: Torsten Mueller | last post by:
I have to port a program from Windows to HPUX. It has an algorithm iterating over files of a directory and all of it's subdirectories using _findfirst() and _findnext() on a structure called...
2
by: martin | last post by:
hi, I am using vb.net. I have wrote a data access class and one of my methods returns a dataset. I would like to iterate through this, although this is proving problematic for me. Can...
2
by: James Doran | last post by:
Hello, I'd like to iterate through each Page of my ASP.NET project from within a Custom web control and access the Page.Controls collection. I've tried using Reflection on the web project...
6
by: eBob.com | last post by:
How do you make a loop iterate early without using a GoTo? (I guess I've done too much structured programming and I really don't like using GoTos.) Here's my code ... For Each Thing As OFI...
3
by: toton | last post by:
Hi, I have a container class, and I want to iterate over a portion of the container class while I insert/remove item from it. Noting down the present location & constructing iterator from there is...
0
by: chongming | last post by:
Hi, i want to display all the filenames on browser. However i found that if there are many filenames in that folder, result will be it will display a long list of filenames on that browser. My...
1
by: prathna | last post by:
Hi .. I have a logic:iterate tag which will display 5 rows each row with a drop downlist and 2 textfields.now by default all the rows will be shown.how do i hide all the rows except the first...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....

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.