Sort the order of file data on the CD
=====================================

Note: this option does not sort the order of the file names that appear
in the ISO9660 directory. It sorts the order in which the file data is
written to the CD image.

This option is useful in order to optimize the data layout on a CD.

To use, type something like:

genisoimage -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 genisoimage 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

Note: There must be only one space or tab character between the filename and
the weight and the weight must be the last characters on a line. The filename
is taken to include all the characters from the first in a line, up to, but
not including the last space or tab character on a line. This is to allow
for space characters to be in, or at the end of a filename.


The command:

genisoimage -o cdimage.iso -sort sort_file cd_dir

will sort the above file data 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
genisoimage. i.e. in the above case, if the command line was:

genisoimage -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 inside of the CD.

Wildcards in the filename list should work.

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 22-Nov-2001

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