Contributor: SWAG SUPPORT TEAM        

{ copy Files With certain extentions to a specific directory (Both
 parameters specified at the command line or in a Text File).. I cannot
 seem to find a command withing TP 6.0 to copy Files.. I have looked
 several times through the manuals but still no luck.. I even asked the
 teacher in Charge and he did not even know! Ok all you Programmers out
 there.. Show your stuff.. If you Really want to be kind, help me out
 on this..I am just starting in TP and this is all new to me!

{$R-,I+} {Set range checking off, IOChecking on}
{$M $400, $2000, $10000} {Make sure enough heap space}
{    1k Stack, 8k MinHeap, 64k MaxHeap }
        Buf = Array[0..65527] of Byte;
        FileFrom, FileTo : File;
        Buffer : ^Buf;
        BytesToRead, BytesRead : Word;
        MoreToCopy, IoStatus : Boolean;

        {Determine largest possible buffer useable}
        If MaxAvail < 65528 then
                BytesToRead := MaxAvail
                BytesToRead := 65528;
        Writeln('Program is using ', BytesToRead , ' Bytes of buffer');
        GetMem(Buffer, BytesToRead);    {Grab heap memory For buffer}
        Assign(FileFrom, 'File_1');
        Assign(FileTo, 'File_2');
        Reset(FileFrom, 1);     {Open File With 1Byte Record size}
        ReWrite(FileTo, 1);
        IoStatus := (IoResult = 0);
        MoreToCopy := True;
        While IoStatus and MoreToCopy do begin
                blockread(FileFrom, Buffer^, BytesToRead, BytesRead);
                blockWrite(FileTo, Buffer^, BytesRead);
                MoreToCopy := (BytesRead = BytesToRead);
                IoStatus := (IoResult=0);
        FreeMem(Buffer, BytesToRead); {Release Heap memory}
        If (not IoStatus) then
            Writeln('Error copying File!!!');