tags:

views:

164

answers:

1

Hello,

I have tried quite a few codes but none of them seem to work the way I want.

How do I zlib (no compression required, just adding all files to data chunk would be ok) all files and sub directories in folder (but not folder itself) while saving all paths, so it would extract them to all the correct paths instead of dumping everything into same folder.

i got jvcl code but it does not compress sub folders.

procedure TJvZLibMultipleMainForm.btnCompressClick(Sender: TObject);
var
  z : TJvZlibMultiple;
begin
  ForceDirectories(ExtractFilePath(edFilename.Text));
  z := TJvZlibMultiple.Create(nil);
  Screen.Cursor := crHourGlass;
  try
    lblFilename.Caption := '';
    pbProgress.Position := 0;
    z.OnProgress := DoProgress;
    z.OnCompressingFile := DoCompressFile;
    z.CompressDirectory(edSrcFolder.Text,false,edFilename.Text);
  finally
    z.Free;
    Screen.Cursor := crDefault;
  end;
  pbProgress.Position := 0;
  lblFilename.Caption := 'Ready';
end;
+5  A: 

Hi, if you want to compress the subfolders must change this line

z.CompressDirectory(edSrcFolder.Text,False,edFilename.Text);

to

z.CompressDirectory(edSrcFolder.Text,True,edFilename.Text);

to activate the compression recursive.

// compresses a Directory (recursing if Recursive is true)
// and saves the compressed result to FileName
procedure CompressDirectory(Directory: string; Recursive: Boolean; FileName: string); overload;

Bye.

RRUZ
Brilliant, works like a charm!Thanks so much!
Tom
I am new to this site, is there any way so I cna give you +1, vote or anything which influences your ranking?
Tom
@Tom. Accept the answer, that gives 15 rep points...
François
Stupid question: where is that button? :-)I only see "answer your question", notify daily of any new answers, etc
Tom
There should be a check mark next to RRUZ's answer. Click that and it will turn green.
Argalatyr
oh, that one, very unclear, thanks
Tom