Saturday, October 22, 2005

MakeCab : Part 3 - Compress multiple files in multiple folders

By default, MakeCab does not preserve folder path when it compress the files.

Try the following directive file and check the CAB file. You will notice the path information is not in the CAB file. Replace the file list with your actual files.


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


To preserve the path information, you have to use the DestinationDir directive. Modify the directive file to look like this:


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


Run the MakeCab against the directive file and open the CAB file. You should see the path information is preserved.

0 Comments:

Post a Comment

<< Home