Files Delphi

Title: file split and merge
Question: split large size of file into more file
Answer:
function Dosya_Bol:Byte;
var
i : Integer;
begin
for i := 1 to 700 do
begin
BlockRead(FromF, Buf, SizeOf(Buf), NumRead);
BlockWrite(ToF, Buf, NumRead, NumWritten);
Form1.PB.Position := Form1.PB.Position+NumRead;
if NumRead = 0 then
begin
Dosya_Bol := 0;
Break;
end;
if NumWritten NumRead then
begin
Dosya_Bol := 1;
Break;
end;
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
i,boy : Integer;
dad : String;
yer : Byte;
begin
OD.Filter := 'Tm Dosyalar|*.*';
if OD.Execute then
begin
Label1.Caption:=OD.FileName;
PB.Position:=0;
AssignFile(FromF, OD.FileName);
Reset(FromF, 1);
PB.Max := FileSize(FromF);
i := 1;
repeat
dad := 'file' + IntToStr(i) + '.blt';
AssignFile(ToF, dad);
Rewrite(ToF, 1);
yer := dosya_bol;
CloseFile(ToF);
i := i + 1;
until yer = 0;
CloseFile(FromF);
Memo1.Lines.Clear;
Memo1.Lines.Add(OD.FileName);
Memo1.Lines.Values['ds'] := IntToStr(i-1);
Memo1.Lines.SaveToFile('ballog.blf');
end;
end;
procedure TForm1.Button2Click(Sender: TObject);
var
d_s,i : Integer;
d_a : String;
begin
OD.Filter := 'Balta dosyalar|*.blf';
if OD.Execute then
begin
Memo1.Lines.LoadFromFile(OD.FileName);
d_a := Memo1.Lines[0];
d_s := StrToInt(Memo1.Lines.Values['ds']);
AssignFile(ToF, d_a);
Rewrite(ToF, 1);
for i:=1 to d_s do
begin
AssignFile(FromF, 'file' + IntToStr(i) + '.blt');
Reset(FromF, 1);
PB.Position := 0;
PB.Max := FileSize(FromF);
repeat
BlockRead(FromF, Buf, SizeOf(Buf), NumRead);
BlockWrite(ToF, Buf, NumRead, NumWritten);
PB.Position := PB.Position + NumRead;
until (NumRead = 0) or (NumWritten NumRead);
CloseFile(FromF);
end;
CloseFile(ToF);
end;
end;