FTP some number of TN Docs to remote system as one file

Unwieldy subject, but I’ll try to explain it better:

We received 830s from Wal-Mart via AS2. Typically, they send five transactions in an envelope (though there is no guarantee that it will always be five).

It TN, each individual 830 is broken out, and published to Broker, where the business process model picks it up, validates it, selects the appropriate map (in this case, from X12 to a canonical structure), translates it and publishes to Broker.

Then another business process model picks it up, selects the appropriate map (in this case, from the canonical structure to a flatFile), and routes it back to TN.

So from five (or some other number) 830s, we now have five (or some other number) flatFiles.

TN invokes a service to FTP the files to the remote system, where a listener is awaiting their arrival. And there’s the rub. The filename sent to the remote system is always the same (filename.dat), and the listener is only configured to pick it up once (and, as is always the case, is not re-configurable). I tried using append rather than put in my FTP service, but the listener only picked up two of the five files.

So what I need is a way to concatenate the flatfiles (which, by the way, are comprised of comma-delimited text records), and do one FTP. The catch, of course, is I cannot say for sure how many files there will be. The good news is that they are in one envelope, and they only arrive once a week (on Saturday).

Thank you in advance for being smarter than me.