本文介绍了如何压缩与命令行中指定的文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

难道你的人告诉我如何压缩指定的文件到同一个压缩文件。让我来告诉我怎样文件夹都充满:

Could you people tell me how to zip specified files into same Zip file. Let me tell how my folders are filled :

  • 在任务计划程序有我的数据库的备份,并将它们保存每天到一个文件中。它创建4数据库备份每天,这意味着将有4每天更多的文件。所以,我需要新创建的备份压缩到同一个zip文件(当然它不同于previous天压缩文件,压缩文件会为这一天为新创建的备份文件被创建),我需要自动执行。嗯,我知道如何使它自动。我可以使用Windows任务调度自动化的东西。

感谢。

推荐答案

您可以使用 DotNetZip - 它原为程序员,但建立在与随库示例应用程序库的使用已经成为他们自己的权利非常有用的。

You can do it with DotNetZip - it was originally produced as a library for use by programmers but the sample apps built on and shipped with the library have become very useful in their own right.

其中的样本被称为zipit.exe的 - 一个控制台工具。指定一个不存在的压缩文件创建一个新的,或者指定现有的压缩文件进行更新。

One of the "samples" is called zipit.exe - a console tool. Specify a non-existent zipfile to create a new one, or specify an existing zipfile to update it.

zipit.exe ZipArchive.zip  c:\data\folder1

您可以指定一个或多个文件名,目录或逻辑EX pression,描述哪些文件包含。对于前pressions:

You can specify one or more filenames, directories, or a logical expression that describes which files to include. For the expressions:

的mtime> 07/01/2009
用的最后修改时间的午夜之后于2009年7月1日的任何文件还有的ctime和atime的用于创建时间和访问时间。

mtime > 07/01/2009
any file with a last modified time after midnight on 1 July 2009. There is also ctime and atime for created time and accessed time.

的ctime> 07/01/2009:07:53:00
上午07点53后,于2009年7月1日与创建时间的任何文件

ctime > 07/01/2009:07:53:00
any file with a created time after 7:53am on 1 July 2009.

尺寸> 320MB
其尺寸超过320MB的文件。您可以使用 KB GB ,太。或省略字符以字节的尺寸。您还可以使用<或=的操作。

size > 320mb
any file with a size over 320mb. You can use kb or gb, too. Or omit the characters for a size in bytes. And you can use < or = as operations.

ATTR!= H
不具有隐藏属性设置的任何文件。其他特性包括S =系统,R =只读,A =存档。当然,你可以测试该属性为ON,以及(使用=代替!=)。

attr != H
any file that does not have the Hidden attribute set. Other attributes include S=system, R=Readonly, A=Archive. Of course you can test that the attribute is ON as well (using = instead of !=).

ATTR = H和大小&GT!; 320MB
包括满足这两个条件中的文件。您还可以使用或作为一起选择。使用到的括号组复杂的EX pressions。

attr != H and size > 320mb
include the files that satisfy both conditions. You can also use OR as a conjuction. Use parens to group complex expressions.

名称= * .jpg或名称= * .gif注意:
包括满足一个或另一个条件的文件。

name = *.jpg or name = *.gif
include the files that satisfy one or the other condition.

(名称= * .JPG)或(NAME = * .gif要点)
与上述相同。

(name = *.jpg) or (name = *.gif)
same as above.

(修改时间&GT; = 07/01/2009)和(修改时间&LT; 07/02/2009)
任何文件修订于7月1日。从午夜到午夜。

(mtime >= 07/01/2009) and (mtime < 07/02/2009)
any file modified on July 1st. From midnight to midnight.

(名称= * .JPG)和(修改时间&GT; = 07/01/2009)和(修改时间&LT; 07/02/2009)
任何.jpg文件修订于7月1日。

(name = *.jpg) AND (mtime >= 07/01/2009) and (mtime < 07/02/2009)
any .jpg file modified on July 1st.

(名称= * .JPG)和(尺寸与GT; = 100KB)和(修改时间&GT; = 07/01/2009)和(修改时间&LT; 07/02/2009)
任何.jpg文件,100KB以上的大小,修订于7月1日。

(name = *.jpg) and (size >= 100kb) and (mtime >= 07/01/2009) and (mtime < 07/02/2009)
any .jpg file, 100kb or more in size, modified on July 1st.

通过对zipit.exe工具的其他选项,你还可以:

With other options on the zipit.exe tool, you can also:

例如:

zipit.exe Archive.zip -D C:\ PROJECT1 -r +(名称= *的.xlsx)和(修改时间&GT; = 07/01/2009)和(修改时间&LT; 07 /二千零九分之三十一)

zipit.exe UNPACK.EXE -sfxW¯¯-D项目2 -r +(名称= * .pdf)的和(尺寸与GT; 100KB)


DotNetZip是免费的。

DotNetZip is free.

所有这些功能都是在图书馆的.NET接口可用了。而且有一个GUI工具,太。

All these features are available in the .NET interface of the library, too. And there's a GUI tool, too.

这篇关于如何压缩与命令行中指定的文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

查看更多