[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Compress directories using pkzip

Posted on 2004-04-02
6
Medium Priority
?
4,216 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
ID: 10744695
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 375 total points
ID: 10746671
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
ID: 10746738
Look for cabarc.exe.
0
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

 
LVL 30

Expert Comment

by:SteveGTR
ID: 10749282
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
ID: 10757055
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
ID: 10765668
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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
Being a system administrator some time we require to do things remotely, one of them is installing software. Here I am going to tell you how to install software through wmic (Windows management instrument console). I am not at all saying that this i…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Suggested Courses

830 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