Help merging .txt files

I have 50-60 .txt files I’d like to merge into one long .txt file. I know there are numerous utility programs available that can do this but the one’s I’ve seen cost $25-$50. Since this is a one time need then I’m not real keen on spending anything to do it. Anyone aware of a free method of merging .txt files?

http://bluefive.pair.com/txtcollector.htm

Here is free one.

Merge multiple text files into one master file. This tool allows you to join many files into a single file. Use this tool instead of open each file and copy the content to paste it to one single file. LINK

Just open your note pad and copy them to one. Takes about 5 min.

Jeffrey…perfect! TXTCollector was just what I was looking for.
Michael, I also tried FileMerge but wasn’t as successful with it. I’m sure it works just fine as well but it didn’t want to work smoothly with my computer…oh well. I should have remembered the ZDNet site for utilities like this, I’ve even got it bookmarked and still didn’t think to check there.
Henry, yeah I could have done it that way but heck that’s why I have a computer…to do all those menial tasks.

Thanks guys…:slight_smile:

Here you go:


$merged = '';
$handle = opendir('C:\Some Folder');
while (false !== ($file = readdir($handle)))
{
    if (substr($file, -4) == '.txt')
    {
        $merged = $merged . file_get_contents($file);
    }
}
closedir($handle);
$handle = fopen('C:\Some Folder\merged.txt', 'w');
fwrite($handle, $merged);
fclose($handle);

:stuck_out_tongue:

Cool…now if I just had an idea how to execute PHP code I’d be home free. I do know it doesn’t work simply by pasting it to a command line prompt.