Re: How to specify the folder that i wish to zip??


[ Related Articles and Replies ] [ DelphiLand Discussion Forum ]

Posted by webmaster Guido on December 27, 2001 at 20:04:22:

In Reply to: How to specify the folder that i wish to zip?? posted by joyce on December 27, 2001 at 08:13:38:

: i tried using
: ShellExecute(Handle, 'Open', 'WinZip32.exe', '-a c:\hihi.zip', nil, SW_NORMAL);

: but i am not able to specify the folder that i wish to zip!

------

The command format for winzip32 is:

winzip32 [-min] Action [options] Filename[.zip] Files

-min specifies that WinZip should run minimized.

Action:
-a for add;
-f for freshen;
-u for update;
-m for move.

Options:
-r include subfolders;
-p store folder information for all files added;
-ex, -en, -ef, -es, and -e0 determine the compression method: eXtra, Normal, Fast, Super fast, and no compression.
-hs includes hidden and system files.
-sPassword to specify a case-sensitive password. The password can be enclosed in quotes, for example, -s"Secret Password".

Filename or Filename.zip is the name of the zipfile that you create. If you don't specify an extension, it will become .zip

Files is a list of one or more files, or the @ character followed by the filename containing a list of files to add, one filename per line. Wildcards (such as *.*) are allowed.

-------------

Examples of commands:

Zip the file data.dat to a file data.zip, with data.dat in c:\source and data.zip in c:\dest

c:\program files\winzip\winzip32 -a c:\dest\data c:\source\data.dat 

Zip all the files of folder c:\source into a zipfile called all.zip and don't show the Winzip window:

c:\program files\winzip\winzip32 -min -a c:\dest\all c:\source\*.* 

With ShellExecute this becomes (I tested it and it works fine):

ShellExecute(Handle, 'Open', 'c:\program files\winzip\winzip32.exe',
 '-min -a c:\dest\all c:\source\*.*', nil, SW_NORMAL); 

Or, if you want to make a procedure that you call like this:
ZipIt('c:\source\*.*', 'c:\dest\data.zip');

then the procedure would be:

procedure TForm1.ZipIt(Source, Destination: string);
const 
  Zipper = 'c:\program files\winzip\winzip32.exe';
var
  Params: string;
begin
  Params := '-min -a ' + Destination + ' ' + Source;
  ShellExecute(Handle, 'Open', PChar(Zipper), PChar(Params), nil, SW_NORMAL);
end;


[ Related Articles and Replies ] [ DelphiLand Discussion Forum ]