Contents - Index


Creating Blocked Zip Files


 

  

NOTE:  This is one of the biggest changes between VCLZip Lite and VCLZip Pro.  VCLZip Lite calls the OnGetNextDisk Event when creating new blocks, whereas VCLZip Pro calls the OnFileNameForSplitPart event.

 

Blocked zip files are spanned zip file images that are created in specific sized physical blocks directly to the hard drive.   This allows you to create spanned zip files without actually creating them directly to diskettes first.   This may be useful, for instance, if you are creating a master installation disk set that will be copied to diskettes many times.  The result of a Blocked zip file will be a series of files, the first with an extension of '.zip.z01', the second with an extension of '.zip.z02' and so on. So if you specified a ZipName of 'BACKUP.ZIP', the result will be 'BACKUP.ZIP.Z01' ... 'BACKUP.ZIP.nnn'... BACKUP.ZIP.  (Notice the last block simply has the .ZIP extension and it is the one that should be used to opened the archive).  These files are structurally the same as a Spanned Disk Set only all files are created in one destination directory instead of to separate disks.  

 

Create a Blocked Zip File by following these steps: 

 

  

Example:

 

With VCLZip1 do 

begin 

ZipName := 'C:\SOMEDIR\BACKUP.ZIP'; 

MultiZipInfo.MultiMode := mmBlocks; 

MultiZipInfo.FirstBlockSize := 700000; /*approximately 1/2 diskette*/ 

MultiZipInfo.BlockSize := 1457600;     /*entire diskette*/ 

FilesList.Add('C:\MYFILES\*.*'); 

Recurse := True;            /* Recurse directories*/ 

Zip; 

end; 

  

All of the files will be created automatically to your hard drive.  There is no need to insert new disks for this operation.  

When transferring Blocked Zip files onto disks, if you wish to make a standard pkzip compatible spanned disk set, be sure:

  

1) You should give each file just the .ZIP extension on the disks. 

 

2) The component (or any unzip utility) expects to find the correct disk label on each disk. For example, Disk 1 should be labeled as PKBACK# 001, Disk 2 should be labeled PKBACK# 002, etc.  If the disk label is not what the component expects, the component will not operate correctly, unless...  

Set the CheckDiskLabels Property to false if you do not want the component to check the disk labels when unzipping spanned disk sets.  You must make sure your program asks for the correct disk and has a way of verifying the correct disk number.  

 

One good reason you may wish to write your own OnFileNameForSplitPart  event is if you wish to write blocked zip files to CD as they are created.  If you are creating backups to CDR then you can't write directly to CD, you must create the file first and then burn it to the CD using your CD burner's api.  So you might do something like the following:

 

procedure TMainForm.OnFileNameForSplitPart(Sender: TObject; var FName: String; PartNum: Integer; SplitType: TSplitPartType);

begin

// When zipping, we need new disk and we want to burn the block

// just written to the newly inserted CD

If (VCLZip1.OperationMode = omZip) then

begin

  // call default to get filename (FName) for block just written to HD

  VCLZip1.DefaultFileNameForSplitPart(FName,PartNum-1,SplitType);

  // Your code can go here to burn the block just written to HD

  // to your CDR.

    // Prompt for next disk

    // Call CD burning api to burn file to CD

end;

// Whether zipping or unzipping return the filename that was asked for

// using VCLZip's default method for getting filename

VCLZip1.DefaultFileNameForSplitPart(FName,PartNum,SplitType);  

end;