Concatenating text files




I'm trying to concatenate multiple text files in Windows 3.11. Can this be done in Windows?
I use this function in DOS (copy *.prn abc.prn) very easily. Is there a way I can do it in Windows? Help would be appreciated.
- Brett Blackbeard


There are a few file management tasks that DOS can accomplish much more efficiently than Windows, and the ability to knit a series of text files together with the copy command is one such example. The ren command also comes to mind; it allows you to rename a group of files in a single operation, as in ren may*.txt june*.txt.
You can, of course, execute both these commands from a DOS session (or with a Run command) under any version of Windows, and that's the method I would recommend. However, if you're willing to dip your toes in the murky waters of batch programming, here's an idea you might want to try. Judge for yourself whether the gain outweighs the pain!
This technique was suggested by Usenet subscriber, Jeff Collins. It has the virtue of simplicity, and it will work with Windows 3.x or 95, but it is only useful if all the files to be copied share the same extension. Use a text editor to create a file called concat.bat as follows:

@echo off
type %1 >> alltext.txt

Let's assume you have a bunch of text files created in April which have an APR extension. You will need to associate the APR files with concat.bat by using File Manager (File--Associate) in Windows 3.x, or via View--Options--File Types in the Windows 95 Explorer. When that's done, whenever you double-click a filename with the APR extension, its contents will be appended to alltext.txt.
If PC World readers can suggest other more elegant alternatives, please contact the Help Screen. I'll try to include them in a future issue.
- Neville Clarkson


Category: Windows 3.x
Issue: May 1997
Pages: 150-151

These Web pages are produced by Australian PC World © 1997 IDG Communications