[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 4270
  • Last Modified:

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.
0
chigs20
Asked:
chigs20
1 Solution
 
SteveGTRCommented:
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
 
SteveGTRCommented:
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
 
rogerperkinsCommented:
Look for cabarc.exe.
0
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
SteveGTRCommented:
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
 
lbertaccoCommented:
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
 
K_2KCommented:
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: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now