调用winrar压缩多个文件问题!(200分)

  • 主题发起人 主题发起人 zjmg
  • 开始时间 开始时间
Z

zjmg

Unregistered / Unconfirmed
GUEST, unregistred user!
程序有3个窗口:<br>Form1:主窗口含菜单、OpenDialog1(选择要压缩的文件);<br>Form2:含Combobox1(年份选择);<br>Form3:含Edit1(自动产生压缩文件名);<br>在Form1中点击菜单---然后弹出OpenDialog1选择多个要压缩的文件---显示Form3并把Form2中的显示年份的Combobox1.text的值赋予Form3中的Edit1.Text(用作rar文件名)---最后调用Winrar文件对OpenDialog1中选中的多个文件进行压缩。这一过程怎样实现?
 
楼主留下 EMail ,发个 Demo 给你。
 
可以看一下WINRAR的帮助,关于命令的,非常简单实用.<br>剩下的就是组合成你要的命令执行一下就是了.
 
我的E-Mail:zjm6008@yahoo.com.cn 先谢谢了!
 
WinRAR &nbsp;&lt;command&gt; -&lt;switch1&gt; -&lt;switchN&gt; &lt;archive&gt; &lt;files...&gt; &lt;@listfiles...&gt; &lt;path_to_extract/&gt;<br><br> winrar a backup @backup.lst<br><br><br><br>It is possible to perform WinRAR commands from the command line. Common command line syntax is described below:<br><br> &nbsp;WinRAR &nbsp;&lt;command&gt; -&lt;switch1&gt; -&lt;switchN&gt; &lt;archive&gt; &lt;files...&gt; &lt;@listfiles...&gt; &lt;path_to_extract/&gt;<br><br>command Character combination denoted function to be performed by WinRAR<br>switch Switches used to define a specific type of operation, compression strength, type of archive, etc.<br>archive The name of the archive to process.<br>Files The name(s) of files to be processed.<br>Listfiles Listfiles are plain text files that contain names of files to process. File names should start at the first column. It is possible to put comments to the listfile after // characters. For example, you may create backup.lst containing the following strings: &nbsp; &nbsp;c:/work/doc/*.txt //backup text documents &nbsp; &nbsp;c:/work/image/*.bmp //backup pictures &nbsp; &nbsp;c:/work/miscand then run: &nbsp; &nbsp; &nbsp; winrar a backup @backup.lstYou may specify both usual file names and list files in the same command line.<br>Path_to_extract Used only with commands e and x, indicating the folder in which to place extracted files. If this folder does not exist, it will be created.<br>Notes<br>a) If neither files nor listfiles are specified, then *.* is implied and WinRAR will process all files;<br>b) If archive extension is not specified, WinRAR will use the default archive format selected in the default compression profile, but you may override it specifying either .RAR or .ZIP extension;<br>c) switches entered on the command line override the same configuration settings;<br>d) for commands c, e, s, t, rr, k and x wildcards may be used in the archive name. Thus it is possible to process more than one archive with a single command. Moreover, if you specify -r switch with these commands, they will search for archives in subfolders;<br><br>e) some commands and switches are applicable only to RAR archives, some both to RAR and ZIP and some to all archive formats. This is dependent upon the functionality provided by the archive format;<br>f) commands and switches are not case sensitive, you may write them both in upper and in lower case.
 
WINZIP的<br><br> &nbsp; &nbsp; &nbsp;//开始压缩<br> &nbsp; &nbsp; &nbsp; &nbsp;with zipper do<br> &nbsp; &nbsp; &nbsp; &nbsp;begin<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;FilesList.Clear;<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;RootDir := SysDirectry; // 决定本目录下filelist中使用通配符的文件<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;FilesList.Add('*.dat');<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ZipName := ZipFileName; //压缩文件的文件名<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Recurse := False; //是否递归,当用通配符的时候<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;StorePaths := False; // 是否存储文件的路径名<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;StoreVolumes := False; //是否保存卷的信息<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;PackLevel := 5; //压缩的等级<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Dispose := False; //文件压缩后源文件是否删除<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;MultiZipInfo.MultiMode := mmNone; //<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ZipAction := zaUpdate;<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;MultiZipInfo.WriteDiskLabels := False;<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Store83Names := True;<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;PassWord := '12345';<br> &nbsp; &nbsp; &nbsp; &nbsp;end;
 
用vclzip控件多好。。
 
楼主的回复时间是:2006-4-27 5:31:36 &nbsp;,精力正好!<br>邮件已发出,楼主请注意查收。
 
十分感谢liyinwei!多谢了!
 

Similar threads

回复
0
查看
1K
不得闲
D
回复
0
查看
825
DelphiTeacher的专栏
D
D
回复
0
查看
831
DelphiTeacher的专栏
D
后退
顶部