Making archives with Fold

										Version 1.16e English
										5 april 2002


Before starting with Fold read the License Agreement ("license.txt").

With Fold you can compress individual files as well as make archives containing more than one file.
The package contains three programs:

		- Fold, the main program
		- Unfold, a separate decompressor and extractor
		- Foltoexe for creating selfunfolding files and archives.

Requirements

All three programs require a Intel 80286 processor or newer and MS-DOS 3.3 or newer.

Usage

The main program Fold can compress as well as decompress, thereby creating individual Fold-files
(containing one compressed file) or Fold-archives (containing one or more files).

The program Unfold is able to decompress individual Fold-files as well as archives, determining
automatically the filetype. At extracting from archives you can use the DOS-jokers '*' and '?',
however the '?' has the same meaning as '*', representing all remaining characters in the part
of the filename. All files complying to the filespecification will be extracted from the archive.

With Foltoexe you can transform folded files or archives to selfdecompressing programs. These 
programs only have to be started to unfold all the files it contains. This is comfortable to send
compressed files to people who are not well versed in parametersyntax on the DOS command line.

With compressing as well as decompressing you can give a directory that serves as destination
for the resulting file(s). Non-existing directories will be created, however only up to one level.
For instance, if you give "unfold name.fol c:\maindir\foldir" and the directory 'maindir' has no
subdirectories, then 'foldir' will be created as such. However if 'maindir' does not exist too, the 
operation fails. In all programs the destinationdirectory is given as last of the parameters.
Programs created by Foltoexe cannot create directories; it will place the file(s) in an existing 
destinationdirectory though.

You can remove files from an archive. However for safetyreasons this is done only one file at a time,
so you cannot use jokers in this case.

The programs always warn before overwriting files.

Use of the parameters

	Parameters are separated from each other and from the name of the program by at least
	one space-character.

	Fold

	Syntax:		Fold c[n[z]]/d[x] file(s) [directory]
				Fold a[n[z]]/e[x]/v/w archive [file(s)][directory]


	The first parameter of Fold consists of a combination of at most three characters, each
	character having a separate meaning.
	The first character indicates the requested action:

		a	archiving, this is compressing to a existing or newly created archive.
			In this case the second parameter must give the name of the archive,
			and the third the file(s) to be added.

		e	extracting, this is decompressing of one or more file(s) from an archive.
			Here too the second parameter must specify the archive, and the third
			the file(s) to be unfolded. If this parameter is omitted all files from the 
			archive will be extracted.

		c	compressing, this is folding of a file as an individual Fold-file.
			The second parameter specifies the file(s) to be folded. The number
			of resulting files will be equal to the the number of source-files. The
			resulting files are given '.fol' as an extension, or, if the file already exists,
			an extension that follows this one alphabetically, e.g. 'fom', 'fon', etc.

		d	decompressing, this is the unfolding of individual Fold-files, which must
			be given as second parameter.

		v	viewing, giving a list of all files contained in an archive. The name of the
			archive is specified in the second parameter.

		w	removing ('wissen'), this is deleting a file from an archive. The second 
			parameter is the name of the archive, the third the name of the file to be
			removed. You can give only one file to be removed. A confirmation is
			requested by the program. If two or more files of the same name exist
			in the archive, only the first one will be removed.

	With a, c and d the parameters specifying files (not archives) may contain wildcards.
	The same holds for e (extracting files from an archive) but with a different meaning of the
	question-mark '?' as explained above (in the second alinea under 'Usage').

	The second character of the first parameter is different in different actions: at compressing
	('a' or 'c') it must be a decimal digit determining the level of compression, at decompressing
	('e' or 'd') it consists of a character 'x' meaning the resulting file(s) must get a different extension,
	thereby providing the possibility of comparing the decompressed file to the original.
	The level of compression may be omitted, setting the level to a default of between 3 and 4.

	The third character (consisting of 'z') is only given at compression and puts it in a special mode
	suitable for files consisting of random bytes (like files already compressed), which are usually
	not easy to make smaller. In some cases with this mode you can achieve a better compression
	or reduce the expansion.

	Unfold

	Syntax:		Unfold file(s)/archive [file(s)] [directory] [/v]/[/x]

	For Unfold a action-parameter needs not to be given. It automatically assumes decompression
	or extraction in case of an archive. The first parameter must be the file(s) to be decompressed or
	the archive to be extracted from. In the latter case the file(s) to be extracted form the second
	parameter. Giving a different extension to the resulting file(s) is with Unfold done by using
	'/x' as the last parameter.
	The optional parameters (files/directory/v/x) can be given in any number, however if more than one
	is given the order seen in the syntax above must be respected. Parameters '/v' and '/x' cannot be
	used together.

	Foltoexe

	Syntax:		Foltoexe file/archive
	
	Foltoexe only takes one parameter, the Fold-file or -archive to be changed to an executable. It does
	not accept any jokers. The resulting programs too take only one (optional) parameter, the destination
	directory, which must already exist.

Notes

On questions put by any of the programs you can answer affirmatively by pressing one of the keys
'J', (dutch 'ja'), 'Y' for 'yes' or <enter>. All other keys are taken as a negative answer.

While adding to or removing from an archive Fold creates a temporary file which has a size of the
archive itself or more. Sufficient diskspace should be available for this operation.

The number of files in an archive is bound to a maximum: at present this amounts to 275. The number
of files to be handled in one session of the program is 125.

Examples

		Fold c3 ar?.res \reserve

	All files in the current directory complying to 'ar?.res' are compressed as separate Fold-files 
	to the directory '\reserve', which is a subdirectory of the rootdirectory. Compressionlevel three
	is used.

		Fold c4z a:\tel\getal.dat c:\tal

	The file 'getal.dat' residing on a diskette in drive A: in directory 'tel' is compressed to drive C:, 
	directory 'tal'. Compressionlevel four combined with zipmode is used.

		Fold d gegevens.fol \geg

	The Fold-file 'gegevens.fol' in the current directory is decompressed to directory 'geg' on the
	current drive.

		Fold dx gegevens.fol

	The Fold-file 'gegevens.fol' is decompressed with a new name 'gegevens.lof' within the current
	directory.

		Fold a8 archief.ark \geg\*.dat

	Fold will add all files with extension '.dat' in directory 'geg' to the archive 'archief.ark' in the current
	directory. If the archive does not exist it will be created. Compressionlevel eight is used.

		Fold e \arch\archief2.ark

	All files in the archive 'archief2.ark' residing in directory '\arch' are extracted to the same directory.

		Fold ex archief3.ark *.pas \arch3

	All files with extension '.pas' in the archive 'archief3.ark' are extracted to directory 'arch3'. They
	will get an extension of '.lof'.

		Fold v archief4.ark
	  or:	Unfold archief4.ark /v

	A list of files contained in the archive 'archief4.ark' is shown, pausing after every 21 lines.

		Fold w archief5.ark schillen.weg

	File 'schillen.weg' is removed from the archive 'archief5.ark'.

		Unfold a*.fol \aaa
	
	Unfold decompresses the Fold-files 'a*.fol' to directory 'aaa', which is a subdirectory of 
	the rootdirectory.

		Unfold ..\test4\*.fo? test5

	Unfold searches for the folded files '*.fo?' in directory 'test4', which is a sisterdirectory of
	the current directory and places the unfolded files in directory 'test5', which is a subdirectory
	of the current directory or is created as such.

		Unfold archief6.ark *.bas /x

	Unfold will extract all  files with extension '.bas' with a new extension '.lof' from the archive 'archief6.ark'.

		Unfold archief7.ark test

	Searches file 'test' in archive 'archief7.ark'. If this file is not found then Unfold will (after asking) create
	in the current directory a directory 'test' and extracts all files in the archive to this directory.
	However with

		Unfold archief7.ark test\

	all files are extracted immediately to directory 'test', because Unfold recognizes 'test\' as a directory.

		Foltoexe bestand.fol

	Foltoexe creates a selfunfolding program from Fold-file 'bestand.fol'. When this program is executed
	'bestand.fol' will be unfolded with the original extension.

		Foltoexe archief8.ark

	Foltoexe creates a selfunfolding program from archive 'archief8.ark'. At startup of this program all files
	within the archive will be extracted to the current directory or a directory given at executing time of 
	the program.

Exitcodes

The programs pass the following exitcodes:

		 0	Operation succeeded
		 1	Error by user (wrong syntax or operation cancelled)
		 2	Too little memory
		 3	Error while reading file
		 4	Error while writing file
		 5	Error while creating file
		 6 	Error while creating directory
		 7	File was not created by Fold
		 8	Faulty checksum
		 9	No files found
		10	Too many files
		11	Insufficient diskspace
		12	File was created by different version of Fold.



							Wishing you much pleasure using the programs

							J. Turin
							Hengelo
							The Netherlands.