USING LIST FILES
PKZIP, PKUNZIP and PKSFX offer a powerful feature; list files. List files
are simply listings of files. They are used to simplify command lines,
and make repetitive tasks less troublesome.
List files can allow you to perform some complex tasks which otherwise
would not be possible. List files can not only be read, but can also be
created by PKZIP and PKUNZIP. Also, list files can be created and used by
other programs, such as StupenDOS", PKZOOM" and PKZMENU".
PKZIP and PKUNZIP use List Files in two ways: files to be included and
files to be excluded. If a List File is being created, the contents will
reflect a listing of those files which would have been added, deleted,
extracted or listed during a normal PKZIP/PKUNZIP operation.
List File text may contain:
* Comments
* File Names
* Wild Cards
* Exact Path Names and Files
* Drive Letters
List File text consists of plain ASCII. These files may be created using
any text editor which can produce plain ASCII files, sometimes referred to
as "DOS Text".
All of the following lines would be valid in a List File:
clowns.bmp
*.exe
project.*
MSLR????.QWK
;This is a comment
emp\census.txt ;This is also a valid comment
D:\data\february.wk1
D:\games\majong\*.*
D:\QWK\*.REP
A line in a list file is treated in an identical manner to files specified
on the command line. Note that only files and comments are valid in a
list file. Both forward and backward slashes may be used in a list file.
Reading List Files
A list file can be used in two different ways with PKZIP and PKUNZIP:
* Files to be acted upon in a ZIP operation.
* Files to be excluded from a ZIP operation.
List files are usually specified with an @ (ASCII 64, normally above the 2
on your keyboard). The list file character can be changed by modifying
the configuration file. Please note that the list file generation option
(-@)) will also change to the selected list file character. Avoid using a
character already used for another option.
The simplest example of using a List File is when a .ZIP file is going to
be created containing the files specfied. If a List File called
"test.lst" was created containing the following lines:
*.COM
300Z.TXT
And then used in a PKZIP command:
C:\>pkzip sample.zip @test.lst
All .COM files in the current directory would be added to the .ZIP file
"SAMPLE.ZIP", as well as the file "300Z.TXT" if it existed.
The contents of a List File that is specified are included. The contents
of a List File specified after a -x are excluded. Multiple List Files to
be included and excluded may be specified on the command line in addition
to file names being listed alone on the command line.
Following are several example usages of List Files, each with a short
description of what action would be caused.
C:\>pkzip first.zip @abc.lst -x@xyz.lst
All files specified in "abc.lst" would be added to the .ZIP file
"first.zip". Any files that match the file specification in "xyz.lst"
would not be added.
C:\>pkzip second.zip -d @abc.lst -x*.txt
All files listed in "abc.lst" would be deleted from the .ZIP file
"first.zip". Any files matching the "*.txt" specification would not be
deleted.
C:\>pkzip -vc third.zip @xyz.lst
A file listing with comments will be shown for all files in "third.zip"
which are listed in "xyz.lst"
C:\>pkzip -rp backup.zip *.* -x@noback.lst
A .ZIP file containing the entire drive would be created, excluding any
files which match those in "noback.lst"
Don't forget to use the @ in front of a list file name. If you do not use
the @, the list file itself will be added to the .ZIP file.
Generating List Files
The Generation of list files can have many uses. Some suggested ways to
use this feature are:
* Dividing Files to be Zipped into logical groups
* Easy exclusion of files already Zipped from a PKZIP operation
* Complex Batch File operations
Keep in mind that a plain ASCII list file can be fed through other
programs, like 'sort', and can be used by some other applications such as
StupenDOS or PKZMENU.
The list file generated by PKZIP or PKUNZIP when the -@ option is used
contains the names of all the files which would have been acted upon in a
normal ZIP operation.
In a simple PKZIP command, the list file will contain a listing of all the
files which would have been archived by PKZIP. If the list file is
generated with a freshen or update command, the list file will contain
those files which would have been added/updated in the .ZIP file.
To generate a list file of your entire C: hard drive:
C:\>pkzip dummy -rp -@cdrive.lst
Note that the "dummy" .ZIP file name is necessary to have a valid PKZIP
command.
The list file generated by PKUNZIP will contain those files which would
have been extracted.
Using List files to debug
You may find the generation of list files helpful when you are testing
batch files. Let's say you have created a batch file which should
compress several files as a backup procedure. Perhaps these files are
very large and it takes several minutes to compress each one. This means
that if you were to test the batch file simply by running it, it could
take quite a while to find a problem and fix it.
By generating a list file of what would have been compressed, you can
check very quickly to make certain that the proper files are being
selected.
List file size
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 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 List File size is 5100 bytes. When they are stored
the maximum List File size is 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.
Be Creative
The list file functions give you a whole new level of power with PKZIP.
When defining a problem and searching for a solution, don't forget to
consider the power of these features.
Using the list file features can give you access to new abilities PKZIP
would not have inherently. Here are some example situtations:
Removing Old Files
Suppose a .ZIP file 'work' contains 45 files. The contents of 'work' are
extracted to a work directory and several of the files are deleted. How
do you delete these files that are no longer necessary from the 'work'
archive? Doing it manually would be very tedious.
First create a list of the contents of the directory. By redirecting
these file names to a list file you can capture an image of what needs to
be kept in the .ZIP file.
C:\work>pkzip dummy.zip *.* -@keep.lst
The list file 'keep.lst' now contains the files we want preserved in the
.ZIP file, files not in this list will be deleted:
C:\work>pkzip work.zip -d *.* -x@keep.lstC:\work>del keep.lst
The WORK.ZIP file now contains only those files which are also in the work
directory.
Sorting .ZIP Files
Files will be added to a .ZIP file in the order that they are listed in
the list file. This can be useful if you want the contents of a .ZIP file
to be in a particular order. After generating a list file, bring it into
an editor and modify it to meet your need. To create a .ZIP file that is
sorted in alphabetical order, you would use the following series of
commands:
C:\work>pkzip test.zip *.* -@test.lst
C:\work>sort < test.lst > sort.lst
C:\work>pkzip test.zip @sort.lst
C:\work>del test.lst sort.lst
The SORT command used above is a standard DOS program. See your DOS
manual for further information on this useful feature.