in reply to Dating .tar Archives

As an aside, I once had to deal with a site that needed to store things such that there were reliable modification-dates for the stored material, without the benefit of Microsoft SharePoint or any other such goodness.   And, what I wound up doing was to Zip-compress the material and then store the Zip files.   The header of a Zip archive-entry includes the file mod-date at the time the archive was created.   So, even though the mod-date of the archive file would change, it self-contained an easily queried date-stamp that would not.   I couldn’t use tar in this particular project, but it would have done the same.

Replies are listed 'Best First'.
Re^2: Dating .tar Archives
by RonW (Parson) on Jan 05, 2015 at 18:50 UTC

    tar files are not guaranteed to have any kind of "archive header". GNU tar has an optional "volume header", used to help identify the members and sequence of multi-volume1 archives. Other versions of tar might not have this feature. Of course, if a tar file does have a volume header, its mtime would be the creation date of the archive, so one could stop reading the file once the volume header is read.

    ---

    1 "multi-volume" means the tar file may not be the complete archive. The archive may been created in size limited chunks. Use of this feature makes the individual tar files usefully extractable (as opposed to splitting a single tar file, which would require re-assmbly, first). Of course, a file that crosses volume boundries can only be partially extracted.