Results 1 to 2 of 2

Thread: Compressing Files

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Apr 2000
    Posts
    64
    Is there any way I can have it like decompress a file, copy the contents of it, and then paste them and delete the decompessed folder.

    Is there any way to put multiple files as one .dat file and extract these files when required.

  2. #2
    PowerPoster Chris's Avatar
    Join Date
    Jan 1999
    Location
    K-PAX
    Posts
    3,238

    Lightbulb Makecab.EXE and extract.EXE

    Hi Wrestlecar Webmaster, may be you can use the Makecab.EXE and Extract.EXE that come with the Visual basic 6.0.

    With the Makecab.EXE you can compress multiple file into a single cabinet file with any name that you wish.

    As for the Extract.EXE with allow you to extract the cabinet file into a specified new or old folder. OR even you can extract a single file from the cabinet itself without extract the entire cabinet file.

    The command just as easy as below:

    Assume my fianl cabinet file name is testing.cab and my Directive file is sample2.txt.

    Code:
        'Make compress cabinet file
        Shell App.Path & "\makecab.exe /f " & App.Path & "\sample2.txt", vbHide
    
        'Decompress the cabinet file
        Shell App.Path & "\extract.exe /e /l " & App.Path & "\nFolder testing.cab", vbHide
    The Makecab.EXE need the directive file when you do a multiple files compression. Basically, this directive file just a list of all the files that you wish to compress.

    below is the sample directive files that I was used to create the testing.cab. Again, the directive file name can be any name that you like.

    Code:
    .OPTION EXPLICIT
    .Set Cabinet=off
    .Set Compress=off
    .Set MaxDiskSize=CDROM
    .Set ReservePerCabinetSize=6144
    .Set DiskDirectoryTemplate=".."
    .Set CompressionType=MSZIP
    .Set CompressionLevel=7
    .Set CompressionMemory=21
    .Set CabinetNameTemplate="Testing.CAB"
    .Set Cabinet=on
    .Set Compress=on
    "E:\Test\SourceFile\manual.doc"
    "E:\Test\SourceFile\sampledata.txt"
    "E:\Test\SourceFile\readme.txt"
    "C:\Winnt\explorer.exe"
    As you can see, those line start with .Set is must be in the directive file, else the makecab.EXE may not be able to create the cabinet file as you wish.

    Here is your final cabinet file name:
    Code:
    .Set CabinetNameTemplate="Testing.CAB"
    and here is the list of all you files that need to be compress, do remember to provide a full file path in each file, else error may occurs.
    Code:
    "E:\Test\SourceFile\manual.doc"
    "E:\Test\SourceFile\sampledata.txt"
    "E:\Test\SourceFile\readme.txt"
    "C:\Winnt\explorer.exe"
    After you run the Makecab.EXE, there will be two more files being created:
    • setup.inf
    • setup.rpt


    The setup.rpt just a summerize for the compression result:
    Code:
    MakeCAB Report: Mon Jun 05 11:49:54 2000
    
    Total files:              4
    Bytes before:       188,176
    Bytes after:         75,899
    After/Before:            40.33% compression
    Time:                     0.34 seconds ( 0 hr  0 min  0.34 sec)
    Throughput:             538.90 Kb/second
    For the setup.inf, it a list of files that contain inside the testing.cab file:
    Code:
    ;*** BEGIN **********************************************************
    ;**                                                                **
    ;** Automatically generated on: Mon Jun 05 11:49:54 2000           **
    ;**                                                                **
    ;** MakeCAB Version: (32) 1.00.0601 (03/18/97)                     **
    ;**                                                                **
    ;*** BEGIN **********************************************************
    [disk list]
    1,Disk 1
    [cabinet list]
    1,1,Testing.CAB
    [file list]
    1,1,manual.doc,10752
    1,1,sampledata.txt,0
    1,1,readme.txt,0
    1,1,explorer.exe,177424
    ;*** END ************************************************************
    ;**                                                                **
    ;** Automatically generated on: Mon Jun 05 11:49:54 2000           **
    ;**                                                                **
    ;*** END ************************************************************
    But I just having some problem in determine when was the cabinet file is completelly created?
    Currently I just perform a Do...Loop to check the existing final cabinet file in my destination directry until I get it. But I don't think this the best solution to detect the end of the compression process. So, can anybody commecnt on this?




Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width