Opening 20,000 notepad files and appending to one document

Please support our C# advertiser: Intel Parallel Studio Home
Reply

Join Date: Apr 2007
Posts: 103
Reputation: mariocatch is an unknown quantity at this point 
Solved Threads: 17
mariocatch mariocatch is offline Offline
Junior Poster

Opening 20,000 notepad files and appending to one document

 
0
  #1
May 8th, 2007
Hey all:

I've been trying to figure out how I would go about doing the following task.

Basically, I have a folder with about 20,000 notepad files. My goal is to have one big word document, and append the contents of each notepad file to the word document. Each notepad file only has about 1 line of text (10-15 words).

I'm not looking for any code on how to do this, just loooking for a pseudo explanation on an approach i could take to tackle this.
Thanks
Reply With Quote Quick reply to this message  
Join Date: Apr 2005
Posts: 16,142
Reputation: jbennet is a name known to all jbennet is a name known to all jbennet is a name known to all jbennet is a name known to all jbennet is a name known to all jbennet is a name known to all 
Solved Threads: 531
Moderator
Featured Poster
jbennet's Avatar
jbennet jbennet is offline Offline
Moderator

Re: Opening 20,000 notepad files and appending to one document

 
0
  #2
May 8th, 2007
i know that in C# you can use the streamreader function to read text files (part of .net)

please do not post the same thread in two forums by the way

http://www.daniweb.com/techtalkforums/thread77732.html
http://www.daniweb.com/techtalkforums/thread77733.html
If i am helpful, please give me reputation points.
Reply With Quote Quick reply to this message  
Join Date: Apr 2007
Posts: 6
Reputation: kmillen is an unknown quantity at this point 
Solved Threads: 0
kmillen kmillen is offline Offline
Newbie Poster

Re: Opening 20,000 notepad files and appending to one document

 
0
  #3
Jun 13th, 2007
1. Get all the file names with something like this, where 'parenFolder" is the top directory of the notepad files and extension is "*.txt".

//on exit, "files" will contain the desired list
//assumes parentFolder is valid and not null
private void GetProgramFiles(string parentFolder, ArrayList files, string extension)
{
//if sub folders exist, recurse for each sub folder
foreach(string subDirectory in Directory.GetDirectories(parentFolder))
{
//recurse down
GetProgramFiles(subDirectory, files, extension);
}
//files from current folder
files.AddRange(Directory.GetFiles(parentFolder, extension));
}

2. Iterate through them
3. Write their contents to a doc file.
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 5,264
Reputation: iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold 
Solved Threads: 377
Featured Poster
iamthwee's Avatar
iamthwee iamthwee is offline Offline
Posting Expert

Re: Opening 20,000 notepad files and appending to one document

 
0
  #4
Jun 13th, 2007
There is no need to recurse through any directories. He said he has one folder with all the files immediately there.
*Voted best profile in the world*
Reply With Quote Quick reply to this message  
Join Date: Apr 2007
Posts: 103
Reputation: mariocatch is an unknown quantity at this point 
Solved Threads: 17
mariocatch mariocatch is offline Offline
Junior Poster

Re: Opening 20,000 notepad files and appending to one document

 
0
  #5
Jun 13th, 2007
was also over a month ago i asked for help on this lol. i figured it out a while ago, and i specifically said in my post i don't want someone to code it for me.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC