0

Is there a file table, or inode structure (like in filesystems) of a zip or tar file?

2

No. Both tar and zip formats are designed so you can add files onto the end. Individual files or directories are added as contiguous header + data segments. There is no filesystem that allocates blocks to files in a non-contiguous fashion.

Tar files have no directory mechanism. Each tar header tells the file name, mode bits, userid and groupid, timestamp and filesize of the data segment that follows. End of the tar archive is marked by a null header. The way to know what's in a tar file is to read it, though if it's on disk, you can jump from one header to the next by seeking over the data segments.

Zip files follow the same conceptual format of repeated header + data segments but add a directory onto the end.

Zip format

  • So to clarify, the header's info on the filesize dictates where the file ends and the next begins? And the central directory just dictates the offset on where the file begins? – agz Jan 20 '13 at 5:14
  • 1
    @agovizer The directory at the end is largely redundant of the information in the individual headers. The reason for it is to avoid having to scan the entire archive to find out what's in it, as has to be done with a tar file. – Nicole Hamilton Jan 20 '13 at 16:25

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.