Solved

Compress directories using pkzip

Posted on 2004-04-02
6
3,934 Views
Last Modified: 2008-02-26
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.
0
Comment
Question by:chigs20
6 Comments
 
LVL 30

Expert Comment

by:SteveGTR
Comment Utility
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.
0
 
LVL 30

Accepted Solution

by:
SteveGTR earned 125 total points
Comment Utility
You could try this. It creates a backup.zip file and zip's up 2000 files at a time. You must run the batch from the directory where you want to zip up the files:

@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% (
        set filecnt=0
        pkzip %filename% @__files.txt
        pause
      )  
   
      echo %%a >> __files.txt
      set /A filecnt+=1
    )
  )
)

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

echo.
echo %filename% created

Good Luck,
Steve
0
 
LVL 2

Expert Comment

by:rogerperkins
Comment Utility
Look for cabarc.exe.
0
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 
LVL 30

Expert Comment

by:SteveGTR
Comment Utility
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
0
 
LVL 11

Expert Comment

by:lbertacco
Comment Utility
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)
0
 
LVL 8

Expert Comment

by:K_2K
Comment Utility
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
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Using dates in 'DOS' batch files has always been tricky as it has no built in ways of extracting date information.  There are many tricks using string manipulation to pull out parts of the %date% variable or output of the date /t command but these r…
VALIDATING DATES One method of validating dates is to jam the date into the DATE command and see if it accepts it by examining the system's errorlevel value. A non-zero result indicates failure. A typical example might look something like the fol…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now