-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathI_BYTCPY.PAS
More file actions
78 lines (69 loc) · 1.44 KB
/
Copy pathI_BYTCPY.PAS
File metadata and controls
78 lines (69 loc) · 1.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
procedure bytecopy(fn1,fn2:string);
var f1,f2:file;
f3:file of byte;
b:byte;
stepsize,numsteps:longint;
l,l1:longint;
step,stepc,stepac:byte;
stepa:array[1..8192] of byte;
r,r1,r2:integer;
begin
assign(f1,fn1);assign(f2,fn2);assign(f3,fn1);
{$I-}
reset(f3);
r1:=ioresult;
stepsize:=filesize(f3);
close(f3);
if stepsize>8192 then begin;numsteps:=stepsize;stepsize:=1;end
else numsteps:=1;
reset(f1,stepsize);
r2:=ioresult*1000;
if r1+r2<>0 then
begin
say(1,10,0,'WARNING: COULD NOT COPY');
say(1,18,0,fn1+' TO '+fn2);
say(1,28,0,strnum(r2));
readln;
halt;
end else rewrite(f2,stepsize);
if stepsize=1 then
begin
step:=numsteps DIV 8192;
r:=numsteps MOD 8192;
l:=8192;
end else
begin
step:=1;
r:=0;
l:=1;
end;
for stepc:=1 to step do
begin
blockread(f1,stepa[1],l);
blockwrite(f2,stepa[1],l);
end;
if r<>0 then begin
blockread(f1,stepa[1],r);
blockwrite(f2,stepa[1],r);
end;
close(f1);close(f2);
{$I+}
end;
procedure bytecopyall(kitpath,ext,copypath:string);
var sr:searchrec;
begin
while (length(kitpath)>1) and (kitpath[length(kitpath)]<>'\') do
begin
kitpath:=copy(kitpath,1,length(kitpath)-1);
end;
{
say(1,170,1,kitpath+'*.'+ext);
say(1,180,1,copypath);}
findfirst(kitpath+'*.'+ext,anyfile,sr);
while doserror=0 do
begin
{ say(25,190,1,sr.name); }
bytecopy(kitpath+sr.name,copypath+sr.name);
findnext(sr);
end;
end;