Last week, I wanted to write a few files to a cd and give to my father. Those were mp3 files. I tried mkisofs (genisoimage) but the result was not acceptable. Almost all file names were screwed due to name size limitation of iso9660. Also, I did not want the folder hierarchy as I was not sure if my dad's mp3 player will accept it.
Today I sat down to make this happen. There might have been other ways. But, this looked simpler than googling for hours for the most optimum ways....
Write a small program to do the linking...
int main(int argc, char *argv)
sprintf(str,"ln -s \"%s\" .",argv[i]);
Compile it into a program (say lnk)
gcc lnk.c -o lnk
Create a folder to hold the links to your mp3 files & enter that folder
Create the link from source folder to here
find ../mp3-collection/ -name "*.mp3" | xargs -d '\n' ./lnk
Make your iso file...
genisoimage -ldots -allow-lowercase -allow-multidot -f -J -joliet-long -r -o temp.iso temp/*
(I spent 5 - 10 minutes reading genisoimage man page. Feel free to do the same. -f: follow sym link, -J: Joilet extn, -r: Rock ridge extn)
you can now mount this and check the file names etc (mount -o loop temp.iso /mnt). After you are happy with your brand new iso image, use wodim to write it to a cd
wodim dev=/dev/cdrw temp.iso
Catch: We are creating sym links from a folder tree to a single folder. This can cause issues with same file name repeating. An enhancement to lnk.c can be to check the return status of 'system' call and then modify the file name string accordingly.