![]() |
| ||
| Opening 20,000 notepad files and appending to one document 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 :) |
| ||
| Re: Opening 20,000 notepad files and appending to one document 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 |
| ||
| Re: Opening 20,000 notepad files and appending to one document 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. |
| ||
| Re: Opening 20,000 notepad files and appending to one document There is no need to recurse through any directories. He said he has one folder with all the files immediately there. |
| ||
| Re: Opening 20,000 notepad files and appending to one document 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. |
| All times are GMT -4. The time now is 10:56 am. |
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC