|
Post by herry2009 on Feb 18, 2010 0:05:16 GMT -5
I looked at the Forum but did not. My doubt is ..
(*.*) Compress a directory and subdirectories (Delphi 7 or 2010)
See. I want to compress a directory and all what one has inside. (folders, files, etc.)
indicating the location of the directory on disk eg c: \ test1
Any help or solution?
|
|
|
Post by rwerning on Feb 18, 2010 13:56:51 GMT -5
There may be some subtle differences with the latest version, I haven't upgraded to it yet. But doing what you want is a simple task.
procedure TForm1.Button1Click(Sender: TObject); begin With TVCLZip.create(self) do try Recurse := True; SkipIfArchiveBitNotSet := False; ResetArchiveBitOnZip := False; StorePaths := True; FilesList.Add('C:\Temp\*.*'); TempPath := 'C:\'; ZipName := 'C:\Test.zip'; Zip; finally Free; end; ShowMessage('ZIP completed!'); end;
|
|
|
Post by herry2009 on Feb 19, 2010 2:49:53 GMT -5
Thanks for the tip friend.
Another question. How to unpack this 'test.zip' correctly? What better procedure?
(Maybe my procedure is wrong.)
|
|
|
Post by rwerning on Feb 19, 2010 14:30:36 GMT -5
This should work for you. I added a couple comments to clarify what is being set.
procedure TForm1.Button2Click(Sender: TObject); var NumUnZipped: integer; begin NumUnZipped := 0; WIth TVCLUnZip.create(self) do try ZipName := 'C:\Test.zip'; // file name to extract DoAll := True; // extract all files OR ... // FilesList.Add('*.pas'); // Can extract only some files if needed
DestDir := 'C:\TempOut'; // extract files to a specific folder OR // RootDir := 'c:\Temp\extract'; // Can use a relative path instead
// OverwriteMode = (Prompt, Always, Never, ifNewer, ifOlder); OverwriteMode := TUZOverwriteMode(Always); RecreateDirs := True; // allowed to create new folders RetainAttributes := True; // Password := 'somepassword'; // if encrypted NumUnZipped := UnZip; ShowMessage('UNZIP completed - ' + IntToStr(NumUnZipped) + ' files'); finally Free; end; end;
|
|
|
Post by herry2009 on Feb 19, 2010 23:14:06 GMT -5
thanks friend .. You know a lot of vclzip. The trial material was created vclzip very incomplete (this is my opinion) ... They should create more examples and post on the official site would help sales of the product after the "trial" ends.
|
|