This project is read-only.

possible to exclude files from ziping VB2005

Dec 14, 2010 at 10:56 PM
Edited Dec 14, 2010 at 10:57 PM

Is there some way to exclude files before it is added into the zip file. I'm using VB2005

I'm new to Dotnetzip and planning to use it in my program to zip a backup copy of contents of CF flash cards befor it is prepeard for new use.
I use the demo app Zipit as a base since I had hard time to find how to add multiple files and folders and this had it ready to be modified.
I want to exclude a file since it makes the backup zip big and is not important for later use of the backup zip files. This "big" file is only around 10MB But since
It may end up to have several of these backup files stored before it is copied over to another computer. It is fine if it could be as small as possible and remove unimportant files. 

Dec 17, 2010 at 6:48 PM

yes, you can specify critieria  fpr including or excluding files on the command line for zipit.exe

not sure if you are using VB2005 or not, since zipit itself is a working application.  you don't need to change it in order to use it.  Also zipit is written in C#, not VB. 

From the help message generated by zipit.exe, the selector is how you specify which files to include or not.  Snip:

 <selector>           - a file selection expression.  Examples:
                          (name = *.txt) OR (name = *.xml)
                          (attrs = H) OR (name != *.xml)
                          (ctime < 2009/02/28-10:20:00)
                          (size > 1g) AND (mtime < 2009-12-10)
                          (ctime > 2009-04-29) AND (size < 10kb)

So I guess you'd want to do something like (name != 'LargeFileYouDontWant.eee') as a selection criterion.


Dec 18, 2010 at 9:12 AM


Thanks for answering.  In the dev kit zip  for Dotnet zip there is an example folder for VB. and the winform zipup. I called it Zipit by misstake. sorry.
 I think it is for VB2008, but i have copied it over to VB2005.

I plan to use the demo with some changes to do the zipping in a bigger program and want to exclude certan file. One file. The progam has windows forms.

I hope this clearify what I ask for.


Dec 21, 2010 at 10:55 PM

I have some what find a way to do this but I hoped to do this in one process.
I now a routine that remove the one big file by name after the zipping of the flashcard is completed.

Dec 23, 2010 at 8:05 PM

The criteria I described above can be used within a program, if you call AddSelectedFiles. check the reference documentation.

For an alternative, you could just search on the disk.  There are examples that show how to do this with LINQ in VB.NET, on the dotnetzip website.  Check the third example on that page.   If you don't want to use LINQ, you can do your own search, and call AddFiles() with the list of files to add.