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 :)

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.

There is no need to recurse through any directories. He said he has one folder with all the files immediately there.

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.

This article has been dead for over six months. Start a new discussion instead.