473,396 Members | 2,038 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,396 software developers and data experts.

C#-APP: Multi-threading file processing

Hi There,

I have a question about a program I'm writing.

The program has to do the following:
1) recursive look files in directory
2) process all the files found in the directories

Point 1 works excellent, it looks all the directories specified and uses threading to do so.
The files found are stored in a listview ( and now also in a temp table in SQL).

What I would like to do is point 2.
This has to happen as soon as there is 1 file found, and it has to be another, or multiple threads, because of the speed of the program.

I don't really know how to start multiple threads (for example 10 at the time) to process my files...
The fileprocessing has to read all the contents of the file and store the contents in a database (the files are INI structured files)

Could somebody please help me with this?

Thanx
Nathan
Dec 18 '07 #1
2 2449
Plater
7,872 Expert 4TB
Are you using the Directory.GetFiles() function (with the overload that says to look in subfolders too) ?

That aside. Have you checked into a Queue object? (I think it's under System.Collections somewhere) it has a first in / first out thing that could be used with a mutex to make sure the threads go in order?

If you make one thread do what you want to do, spawn like 9 more to do the same thing?
Dec 18 '07 #2
Hi Plater,

Indeed I'm using Directory.GetFiles(path, pattern).

Thank you for the suggestion for the Queue object (System.Collections or System.Collections.Generic)
Tomorrow I will give it a try to play around with the Queue object and the Mutex.

I'll let you know ..

Nathan
Dec 18 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: soren juhu | last post by:
Hi, I am developing a C Program for reading over a million files of size 1 kilobytes each and sending the contents to another program using some middle ware. I need some help on designing the...
3
by: ecov | last post by:
Is there any easy way to read into a dataset a file that was created from a BCP command. The file is in a fixed length format. I would also like to be able to write out a dataset to the same type...
5
by: Geoff Pennington | last post by:
My VB.Net app reads an Excel file, processes it one row at a time, and when processing is complete writes the row to a database. The typical file will have several thousand rows and may take a...
3
by: bryu1 | last post by:
Hello, I'm trying to find a way for a web page to do some file processing in the client side before sending it to a server. Is there a way to do that in php (or in some other language)? ...
2
by: idle | last post by:
What is it means File Processing consist struct ?
5
by: B. Williams | last post by:
I need some assistance with random access file processing. I have a function that I would like to change from sequential file processing to random access. Thanks in advance. void...
5
by: wolky | last post by:
hi all my friends... ý have a problem with file processing in c... ý have some questions about it... ý have two txt files... in first one there is a text, in second one there are words that ý...
7
by: vswannabenerd | last post by:
aquestion for a learner === during file processing a file is referenced via what type of variable
3
by: RedRoses | last post by:
Hey guys i really need ur help in my C++ assignment , its very hard 4 me coz its the first time 4 me to take a course in programming or anything related to computer !!! :s so plzzzzzzzzz help me...
2
by: yinglcs | last post by:
Hi, I am trying to use python for file processing. Suppose I have a file like this: I want to build a Hashmap between the line "begin_QOS_statistics" and "end_QOS_statistics" and for each line...
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...
0
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
0
BarryA
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...
0
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...
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...
0
tracyyun
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...
0
agi2029
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,...

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.