1

I'm developping an application with C# that create an ISO image from a CD/DVD, then it lets the user to delete files contained in the Iso file, but so far I didn't find a way to do it. Please if you have any idea. Thanks in advance

Ryan Gates
  • 4,501
  • 6
  • 50
  • 90
user2407200
  • 81
  • 1
  • 1
  • 6
  • I would suspect there is no way to do this in-place due to the unstructured nature of the ISO "format", and that to do this you will have to author a new ISO without the deleted files. – Joe May 27 '13 at 00:06
  • Not quite true, there is structure to an ISO file, as all records are a linked tree. And all child records of a directory constitute a sequential array with the first index being a self referential record to the directory. – iceflow19 Mar 26 '16 at 14:19

1 Answers1

1

You should just change the order in which your program operates. Read in the file hierarchy first, then allow the user to select which files to delete, and then write the remaining out as an ISO file. You should be able to keep the files and directories in a tree data structure. Deleting a folder or file would just delete a corresponding node or leaf.

As to the question of directly deleting a file or directory in an ISO image, the same rules above apply, as the ISO9660 (ECMA-119) format is essentially a serialized tree structure. Simply zero out the corresponding records for the subtrees and leafs you want to delete. Do note however, that such an approach will leave garbage space in the image. And that to actually get the image to be smaller in size, you would need to do a compression operation on the image (re-serialize the hierarchy out to a new file).

iceflow19
  • 752
  • 4
  • 12