Tcl Library Source Code


[ Main Table Of Contents | Table Of Contents | Keyword Index | Categories | Modules | Applications ]


tar - Tar file creation, extraction & manipulation

Table Of Contents


package require Tcl 8.5 9
package require tar ?0.11?

::tar::contents tarball ?-chan?
::tar::stat tarball ?file? ?-chan?
::tar::untar tarball args
::tar::get tarball fileName ?-chan?
::tar::create tarball files args
::tar::add tarball files args
::tar::remove tarball files


Note: Starting with version 0.8 the tar reader commands (contents, stats, get, untar) support the GNU LongName extension (header type 'L') for large paths.


For all commands, when using -chan ...

  1. It is assumed that the channel was opened for reading, and configured for binary input.

  2. It is assumed that the channel position is at the beginning of a legal tar file.

  3. The commands will modify the channel position as they perform their task.

  4. The commands will not close the channel.

  5. In other words, the commands leave the channel in a state very likely unsuitable for use by further tar commands. Still doing so will very likely results in errors, bad data, etc. pp.

  6. It is the responsibility of the user to seek the channel back to a suitable position.

  7. When using a channel transformation which is not generally seekable, for example gunzip, then it is the responsibility of the user to (a) unstack the transformation before seeking the channel back to a suitable position, and (b) for restacking it after.


Bugs, Ideas, Feedback

This document, and the package it describes, will undoubtedly contain bugs and other problems. Please report such in the category tar of the Tcllib Trackers. Please also report any ideas for enhancements you may have for either package and/or documentation.

When proposing code changes, please provide unified diffs, i.e the output of diff -u.

Note further that attachments are strongly preferred over inlined patches. Attachments can be made by going to the Edit form of the ticket immediately after its creation, and then using the left-most button in the secondary navigation bar.


archive, tape archive, tar


File formats