Topic: Macro to concatenate many files (1 of 1), Read 33 times, 1 File Attachment
Conf: VEDIT Macro Language Support
From: Ted Green
Date: Friday, January 03, 2003 04:53 PM

A VEDIT customer made this request:

Trying to concatenate 60 text files from a directory into one large text
file (small 100k files). Should be a simple way to do this with Wildfile
or some other command, but cannot seem to do it. Order of concatenated
files not important, just one after another. Any suggestions on approach
would be greatly appreciated.

I wrote a quick-and-dirty macro (hopefully attached) which performs this operation when run from within the Wildfile macro. Since it is short, I will also list it here:

// CONCATENATE.VDM - Run from WILDFILE, concatenates the current
// file to concat.txt. Allows concatenating all
// files in a directory.
// Usage: 1. Delete any existing concat.txt file
// 2. Run the WILDFILE macro
// 3. Enter the desired filename(s)
// 4. Select "Macro"
// 5. Enter the name of this macro
// 6. Let the WILDFILE run
// 7. When done, concat.fil is the desired file
Reg_Set(14,PATHNAME) //@14 = pathname of current file
Buf_Empty(OK) //Empty current buffer
File_Open("concat.txt") //Open/create the concatenation file
EOF() //Goto end of of it
Ins_File(@14) //Append the "current" file
File_Close(NOMSG) //Close the concatenation file