Compressing multiple files into a single CAB file

To compress multiple files into a single CAB file, you need to use a directive file.


The directive file contain instruction how MakeCab should compress and package the files.

Below is a sample of the most basic directive file. Replace the file list with your actual files.


.OPTION EXPLICIT
.Set CabinetNameTemplate=mycab.CAB
.Set Cabinet=on
.Set Compress=on
"file1.pdf"
"file2.doc"
"This is a third file.doc"

All directive start with ".". Comment start with ";".

In the above example,

option explicit specify all variables must be declared before it is used.

CabinetNameTemplate specify the name of the output CAB file.

Cabinet specify whether include the files in the CAB file. When creating setup package, you can use this directive to exclude certain file such as setup.exe from being included into the CAB file.
Compress specify whether to compress the file.

The remaining lines specify the files to be included into the CAB file.

To compress the files using the directive file, run the following command:


makecab /f your_directive_file.ddf.
Once completed, the CAB file will be created inside a folder named "disk1".

Comments

Popular posts from this blog

Using External Content Types with Stored Procedures with Input Parameters

Validate a SharePoint Date Field against Current Date in Javascript