1Sort the order of file data on the CD 2===================================== 3 4Note: this option does not sort the order of the file names that appear 5in the ISO9660 directory. It sorts the order in which the file data is 6written to the CD image. 7 8This option is useful in order to optimize the data layout on a CD. 9 10To use, type something like: 11 12mkisofs -o cdimage.iso -sort sort_file [other_options] cd_dir 13 14The file 'sort_file' contains two columns of: 15 16filename weight 17 18where filename is the whole name of a file/directory as mkisofs will see it 19and weight is a whole number between +/- 2147483647 20 21The files will be sorted with the highest weights first and lowest last. 22The default weight is zero. 23 24If the filename is a directory name, then all the files in that directory (and 25sub-directories) will use its weight as their default weight. 26 27e.g. 28 29If the directory 'cd_dir' contains two directories called 'dir1' and 'dir2' 30with files 'A', 'B' and 'C' in dir1 and 'X', 'Y' and 'Z', the the file 31'sort_file' could look something like: 32 33cd_dir/dir2 1000 34cd_dir/dir2/Y 2000 35cd_dir/dir1/B -2000 36cd_dir/dir1/A -8000 37 38Note: There must be only one space or tab character between the filename and 39the weight and the weight must be the last characters on a line. The filename 40is taken to include all the characters from the first in a line, up to, but 41not including the last space or tab character on a line. This is to allow 42for space characters to be in, or at the end of a filename. 43 44 45The command: 46 47mkisofs -o cdimage.iso -sort sort_file cd_dir 48 49will sort the above file data as: 50 51cd_dir/dir2/Y 52cd_dir/dir2/X 53cd_dir/dir2/Z 54cd_dir/dir1/C 55cd_dir/dir1/B 56cd_dir/dir1/A 57 58Note: files 'X' and 'Z' both have the weight 1000 - their sort order will then 59be the normal ISO9660 sort order (i.e. alphabetical in this case). 60 61File C will have the default weight of 0 62 63Warning: the filenames in the sort list MUST match the whole path as seen by 64mkisofs. i.e. in the above case, if the command line was: 65 66mkisofs -o cdimage.iso -sort sort_file ./cd_dir 67 68then the sort_file filename will have to changed as accordingly. 69 70Notes 71===== 72 73CDs are written from the middle outwards. High weighted files will be nearer 74the inside of the CD. 75 76Wildcards in the filename list should work. 77 78If a file appears more than once in the source directory tree, then the file 79is only added once to the CD image - i.e. a hard linked file, or symbolic 80link if using the -f option. The file will be sorted according to the 81highest weighting given to any of the linked files. 82 83Zero length files are not sorted - the 'start extent' *may* appear to be in 84the middle of another file after sorting. This is because zero length files 85are given the start extent after the last file added to the CD at that time. 86This address is not changed by the sorting, so it may appear that the file 87address is in another file - however as they are zero length, this will 88not matter! 89 90Directories are not sorted by this flag - directories HAVE to be in the 91ISO9660 sort order - however, the files the directory entry points to, can be 92anywhere on the CD. 93 94Existing files from any previous sessions will not be sorted - they already 95exist on the CD and can not be moved! 96 97I have no idea if this is really useful ... 98 99 100James Pearson 22-Nov-2001 101 102Any comments/problems to j.pearson@ge.ucl.ac.uk 103