Zip files using the Compressed Folders functionality in Windows

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

I need to write a small Windows application (console or forms) (for Windows
XP SP2 & Windows Server 2003), which will check a folder for the presence of
some files, and if they exist, it will zip the files using the inbuilt
Compressed files functionality of Windows (same as the Context Menu -Send to
-Compressed (zipped) folder).

I cannot use any other third party tool (like winzip etc.) because of some
non-technical constraints.

However, I have not been able to figure out how use the zip functionality.
Do I need to call "zipfldr.dll" (in system32 folder) or is there another
way
to do it?

Thanks,
Mayank
 
MadMonk said:
I need to write a small Windows application (console or forms) (for Windows
XP SP2 & Windows Server 2003), which will check a folder for the presence of
some files, and if they exist, it will zip the files using the inbuilt
Compressed files functionality of Windows (same as the Context Menu -Send to
-Compressed (zipped) folder).

I cannot use any other third party tool (like winzip etc.) because of some
non-technical constraints.

However, I have not been able to figure out how use the zip functionality.
Do I need to call "zipfldr.dll" (in system32 folder) or is there another
way to do it?

Could you tell us exactly what the non-technical constraints are? The
normal solution would be to use CSharpZipLib, a free managed zip API -
but without knowing the details of your constraints, we can't know
whether or not that's an option.
 
Hi Jon,

My client doesn't want any "third-party" applications/dlls/libraries
installed on the (production environment) server where this app would run.
Also, another of their objections (which seems valid to me) is, "If Windows
has the inbuilt capability to zip/unzip files, why do we need to install/use
third party code to achieve the same functionality?"

I know that the above might be debatable, but these are the constraints I'm
facing....

Thanks,
MadMonk
 
My client doesn't want any "third-party" applications/dlls/libraries
installed on the (production environment) server where this app would
run.

That's my type of client! My normal response to that is "Let me use the
3rd-party utility which I've used 100 times before and you can have your app
at the end of the week, otherwise it'll take me an extra couple of weeks
possibly more to develop exactly the same thing myself."
 
Hi,
My client doesn't want any "third-party" applications/dlls/libraries
installed on the (production environment) server where this app
would run. Also, another of their objections (which seems valid to
me) is, "If Windows has the inbuilt capability to zip/unzip files,
why do we need to install/use third party code to achieve the same
functionality?"

Just to add what to the others are saying, if you can get your users to
install .NET 3.0, you can use:
http://windowssdk.msdn.microsoft.com/en-us/library/system.io.packaging.a
spx

Or, if you can install VJ# runtime, you can use
http://msdn.microsoft.com/msdnmag/issues/03/06/ZipCompression/default.as
px

Myself, I don't understand how a functionality like zipping wasn't
there from .NET 1.0, but that is life :)

Regards,
Adrian.
 
Interesting. I will happily revise my previous answer to say that this is
the way to go *when* 3.0 is RTM - which should hopefully make this a
non-issue for anything currently only in development.

Now all I have to do is find a comprehensive list of all the new classes in
3.0 ;-p

Marc
 
The Java zipfile classes are undocumented in .NET 2.0, so you will need to
search for documentation on how to use them. They are actually pretty easy
to use, however.

Mike Ober.
 
Thus wrote Michael,
The Java zipfile classes are undocumented in .NET 2.0, so you will
need to search for documentation on how to use them. They are
actually pretty easy to use, however.

You can use Sun's JDK docs for that.

Cheers,
 
Thanks a lot everyone for your replies. This gives me a couple of options to
explore, namely .NET 3.0 & the link sent by Marc Gravell.

MadMonk
 
Back
Top