From: Peter Below (TeamB) <100113.1101@compuXXserve.com> Subject: Re: Appending text files Date: 07 Jan 2000 00:00:00 GMT Message-ID: Content-Transfer-Encoding: 8bit References: <8555mq$rmg22@bornews.borland.com> Content-Type: text/plain; charset=iso-8859-1 Organization: TeamB Mime-Version: 1.0 Reply-To: 100113.1101@compuXXserve.com Newsgroups: borland.public.delphi.winapi > I'm using: > > WinExec('command.com /c copy c:\File1.txt+c:\File2.txt c:\File1.txt', > SW_HIDE) > > to append one text file to another is there a way to do it with the win32 > shell? Who needs the shell for such a simple task . Procedure ConCatFiles(Const targetname: String; Const Sourcenames: Array of String); Var i: Integer; target, source: TFileStream; Begin target := TFileStream.Create( targetname, fmCreate ); try For i:= Low(Sourcenames) To High(Sourcenames) Do Begin source := TFileStream.Create( Sourcenames[i], fmOpenread or fmShareDenyNone ); try target.Copyfrom( source, 0 ); finally source.free; end End; finally target.Free; end; End; Usage would be something like chDir(ExtractFileDir(Application.Exename)); ConcatFiles('sum.txt', ['project1.dpr','unit1.pas','unit2.pas']); Peter Below (TeamB) 100113.1101@compuserve.com) No replies in private e-mail, please, unless explicitly requested! Sent using Virtual Access 5.00 - download your freeware copy now http://www.atlantic-coast.com/downloads/vasetup.exe