Re: How to specify the folder that i wish to zip??
Posted by webmaster Guido on December 27, 2001
In Reply to: How to specify the folder that i wish to zip?? posted by joyce on December 27, 2001:
: i tried using
: 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
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:
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;