mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-23 22:29:44 +02:00
+ added tar creation
git-svn-id: trunk@5046 -
This commit is contained in:
parent
0f6355e805
commit
bfeae0c5f1
@ -18,19 +18,30 @@
|
||||
program prepup;
|
||||
|
||||
uses
|
||||
sysutils;
|
||||
sysutils,libtar,zstream;
|
||||
|
||||
var
|
||||
tarwriter : ttarwriter;
|
||||
c : tgzfilestream;
|
||||
|
||||
procedure dosearch(const dir : string);
|
||||
|
||||
procedure domask(const s : string);
|
||||
Var Info : TSearchRec;
|
||||
Var
|
||||
Info : TSearchRec;
|
||||
hs : string;
|
||||
i : integer;
|
||||
begin
|
||||
If FindFirst (dir+DirectorySeparator+s,faAnyFile,Info)=0 then
|
||||
begin
|
||||
Repeat
|
||||
With Info do
|
||||
writeln (dir+DirectorySeparator+Name);
|
||||
begin
|
||||
hs:=dir+DirectorySeparator+Name;
|
||||
{ strip leading ./ }
|
||||
delete(hs,1,2);
|
||||
tarwriter.addfile(hs);
|
||||
end;
|
||||
Until FindNext(info)<>0;
|
||||
end;
|
||||
FindClose(Info);
|
||||
@ -41,13 +52,13 @@ Var Info : TSearchRec;
|
||||
Begin
|
||||
If FindFirst (dir+DirectorySeparator+'*',faDirectory,Info)=0 then
|
||||
begin
|
||||
Repeat
|
||||
With Info do
|
||||
begin
|
||||
If ((Attr and faDirectory) = faDirectory) and (name<>'.') and (name<>'..') then
|
||||
dosearch(dir+DirectorySeparator+name);
|
||||
end;
|
||||
Until FindNext(info)<>0;
|
||||
Repeat
|
||||
With Info do
|
||||
begin
|
||||
If ((Attr and faDirectory) = faDirectory) and (name<>'.') and (name<>'..') then
|
||||
dosearch(dir+DirectorySeparator+name);
|
||||
end;
|
||||
Until FindNext(info)<>0;
|
||||
end;
|
||||
FindClose(Info);
|
||||
domask('*.elg');
|
||||
@ -55,7 +66,19 @@ Begin
|
||||
End;
|
||||
|
||||
begin
|
||||
if paramcount<>1 then
|
||||
begin
|
||||
writeln('Usage: prepup <name of .tar.gz>');
|
||||
halt(1);
|
||||
end;
|
||||
C:=TGZFileStream.Create(paramstr(1),gzOpenWrite);
|
||||
TarWriter := TTarWriter.Create (C);
|
||||
dosearch('.');
|
||||
TarWriter.AddFile('dbdigest.cfg');
|
||||
TarWriter.AddFile('log');
|
||||
|
||||
TarWriter.free;
|
||||
c.free;
|
||||
end.
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user