使用Winrar压缩具有扁平结构的存档

时间:2014-05-14 19:56:14

标签: c# process .net-4.0 winrar

我在不同文件夹中有一堆档案,我想将所有文件压缩为.zip:

我在尝试:

(path)\WinRAR.exe a -afzip "(path)File.zip" "(path)ToCompress"

出了什么问题:

Zip包含所有文件夹(path),而不仅仅是文件ToCompress


编辑:

DotNetZip参数类似的东西:

  -flat             - store the files in a flat dir structure; do not use the
                      directory paths from the source files.

1 个答案:

答案 0 :(得分:1)

尝试添加-ep

从Rar.exe帮助:

ep            Exclude paths from names
ep1           Exclude base directory from names
ep2           Expand paths to full
ep3           Expand paths to full including the drive letter