Sort the order of files as they appear on the CD
================================================

To use, type something like:

mkisofs -o cdimage.iso -sort sort_file [other_options] cd_dir

The file 'sort_file' contains two columns of:

	filename		weight

where filename is the whole name of a file/directory as mkisofs will see it
and weight is a whole number between +/- 2147483647

The files will be sorted with the highest weights first and lowest last.
The default weight is zero.

If the filename is a directory name, then all the files in that directory (and
sub-directories) will use its weight as their default weight.

e.g.

If the directory 'cd_dir' contains two directories called 'dir1' and 'dir2'
with files 'A', 'B' and 'C' in dir1 and 'X', 'Y' and 'Z', the the file
'sort_file' could look something like:

	cd_dir/dir2		1000
	cd_dir/dir2/Y		2000
	cd_dir/dir1/B		-2000
	cd_dir/dir1/A		-8000

The command:

mkisofs -o cdimage.iso -sort sort_file cd_dir

will sort the above files as:

cd_dir/dir2/Y
cd_dir/dir2/X
cd_dir/dir2/Z
cd_dir/dir1/C
cd_dir/dir1/B
cd_dir/dir1/A

Note: files 'X' and 'Z' both have the weight 1000 - their sort order will then
be the normal ISO9660 sort order (i.e. alphabetical in this case).

File C will have the default weight of 0

Warning: the filenames in the sort list MUST match the whole path as seen by
mkisofs. i.e. in the above case, if the command line was:

mkisofs -o cdimage.iso -sort sort_file ./cd_dir

then the sort_file filename will have to changed as accordingly.

Notes
=====

CDs are written from the middle outwards. High weighted files will be nearer
the in side of the CD.

Wildcards in the filename list *may* work - I haven't tested this yet.

If a file appears more than once in the source directory tree, then the file
is only added once to the CD image - i.e. a hard linked file, or symbolic
link if using the -f option. The file will be sorted according to the
highest weighting given to any of the linked files.

Zero length files are not sorted - the 'start extent' *may* appear to be in
the middle of another file after sorting. This is because zero length files
are given the start extent after the last file added to the CD at that time.
This address is not changed by the sorting, so it may appear that the file
address is in another file - however as they are zero length, this will
not matter!

Directories are not sorted by this flag - directories HAVE to be in the
ISO9660 sort order - however, the files the directory entry points to, can be
anywhere on the CD.

Existing files from any previous sessions will not be sorted - they already
exist on the CD and can not be moved!

I have no idea if this is really useful ...


James Pearson 13-Apr-2000

Any comments/problems to j.pearson@ge.ucl.ac.uk
