Link to home
Start Free TrialLog in
Avatar of chigs20
chigs20

asked on

Compress directories using pkzip

I have a batch file that copies a directory which contains sub-directories and sub-sub directories, etc.  You get the point.  That directory is roughly 100 megs and I want to compress it using PKZIP.  I know you can compress a directory by doing:
PKZIP -r name_file.zip     where -r is recurse subdirectories

My question is when I do that i get the error PKZIP (E19) Insufficient memory.  Any help?

Thanks for the help in advance.
Avatar of SteveGTR
SteveGTR
Flag of United States of America image

It appears to be a limitation of the software. This is what their website says about this problem http://www.pkzip.com/support/faqs/pkzip_dos/index.html#9:

I am receiving insufficient memory when using PKZIP for DOS. Why?

If you are receiving an insufficient memory message, most likely it is because you are trying to compress more files than you have available conventional memory. PKZIP for DOS requires approximately 200K of conventional memory to run, plus 100 bytes per file you attempt to add. Your options are to free up more conventional memory if possible or to compress less files.

Using the above calculations, the DOS version can compress approximately 5000 files.

Note: PKZIP for Windows can compress up to 16,000 files.
ASKER CERTIFIED SOLUTION
Avatar of SteveGTR
SteveGTR
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of rogerperkins
rogerperkins

Look for cabarc.exe.
Couple of adjustments to batch file:

@echo off
setlocal enabledelayedexpansion

set filename=backup.zip
set maxfiles=2000
set filecnt=0

if exist __files.txt del __files.txt > NUL

for /R .\ %%a in (*.*) do (
  if /I "%%~nxa" NEQ "%filename%" (
    if /I "%%~nxa" NEQ "__files.txt" (
      if /I !filecnt! GTR %maxfiles% (
        pkzip %filename% @__files.txt
        set filecnt=0
        del __files.txt > NUL
      )  
   
      echo %%a >> __files.txt
      set /A filecnt+=1
    )
  )
)

if exist __files.txt (
  pkzip %filename% @__files.txt
  del __files.txt > NUL
)

echo.
echo %filename% created
Are you using an old pkzip like v2.50? This has lots of problems. Try a more recent one or, better, you can use "WinZIp command line tools", from www.winzip.com (free but requires winzip) or infozip "zip" utility from http://www.info-zip.org/ (free)
Not enough free time Steve?  
*<;-))

Nice script, I would recommend a much lower maxfiles number, or a check of file size for the cutoff.

Basicly, the below is trying to say PKZIP has to have the file in memory AND have space to process the names left over.

Also, for this type of thing I would register it to get the latest version, whatever that is.

(\o/)  Enjoy,
2K


From PKWARE manual for Version 2.5 :

@[filename]  Specify LIST file
.
.
.

The size of a list file that may be processed is limited. The total
size of the list file depends upon two factors.

The first is path storage. If paths are specified in the list file
and are NOT stored with the -P option, the list file size is limited
to approximately 7000 bytes.

If paths are specified and are stored, the list file size is limited
to 9700 bytes.

If a list file has drive letters specified as part of the file names
within the file, the maximum list file size is reduced. When paths
are not stored the maximum size is 5100 bytes, when they are stored
6600 bytes.

Note that this table corresponds to the total size of all list files
being used in a single command.

+-------------------------------------------------------------------+
| List File Size Limits      |  No Path Storage | Path Storage (-P) |
|----------------------------+------------------+-------------------|
| Drive Letters in List File |    5100 bytes*   |       6600        |
|----------------------------+------------------+-------------------|
| No Drive Letter            |       7000       |       9700        |
+-------------------------------------------------------------------+
* These numbers are approximate and may vary depending on your
  configuration.

If the list file is too big, you will receive an "Insufficient
Memory" error. If you have a list file which is too big, you may
split it into two or more smaller list files and perform multiple
PKZIP operations.


If you use PKZIP on a regular basis you are strongly encouraged to register
it. With a full registration you will receive a comprehensive printed manual,
the latest version of PKZIP, PKUNZIP & PKSFX software, and discounts on
future upgrades of PKZIP for DOS and other platforms. See the documentation
for ordering and commercial & distribution licensing information.
PKWARE, Inc.            Internet:   www.pkware.com      Phone: 414-354-8699
9025 N. Deerwood Drive  Sales:      sales@pkware.com    Fax:   414-354-8559
Brown Deer, WI 53223    Tech supp.: support@pkware.com  BBS:   414-354-8670