ZipFolder

- Posted in Coding by

using ZipFolder from the Windows command-line

ZipFolder is a nifty little Windows command-line utility that is passed two arguments: (1) the folder that is to be compressed into a .zip archive, and (2) the name of the resulting archive (with .zip extension)

Note: this utility requires that you have installed the .NET Framework 3.5 but Windows should prompt you to install it, if it is missing.

The usefulness of this CLI utility lies in the fact that we can leverage it from programming code. Aside from that scenario, most Windows users won't find much reason to use it.

↓ZipFolder

Compress to archive using c-sharp

- Posted in Coding by

I've hosted the source code on GitHub demonstrating using .NET to compress a folder and its contents into a single .zip archive. It also demonstrates decompressing such an archive into its component directory, subdirectories, and files.

To compile, you'll need response file resp.rsp in the same directory as simpleCompExt.cs. The contents of that response file should be:

/r:System.IO.Compression.dll
/r:System.IO.Compression.FileSystem.dll
/out:simple.exe
simpleCompExt.cs

To compile from the command line, execute the following from the source code directory:

csc @resp.rsp

If you want to experiment with this, be sure to add a few small files to the /start subdirectory (so that there's something to compress and extract).