1tar(n)                         Tar file handling                        tar(n)
2
3
4
5______________________________________________________________________________
6

NAME

8       tar - Tar file creation, extraction & manipulation
9

SYNOPSIS

11       package require Tcl  8.4
12
13       package require tar  ?0.4?
14
15       ::tar::contents tarball
16
17       ::tar::stat tarball ?file?
18
19       ::tar::untar tarball args
20
21       ::tar::get tarball fileName
22
23       ::tar::create tarball files args
24
25       ::tar::add tarball files args
26
27       ::tar::remove tarball files
28
29_________________________________________________________________
30

DESCRIPTION

32       ::tar::contents tarball
33              Returns  a  list of the files contained in tarball. The order is
34              not sorted and depends on the order files were stored in the ar‐
35              chive.
36
37
38       ::tar::stat tarball ?file?
39              Returns a nested dict containing information on the named ?file?
40              in tarball, or all files if none is specified. The top level are
41              pairs  of  filename  and  info. The info is a dict with the keys
42              "mode uid gid size mtime  type  linkname  uname  gname  devmajor
43              devminor
44
45              % ::tar::stat tarball.tar
46              foo.jpg {mode 0644 uid 1000 gid 0 size 7580 mtime 811903867 type file linkname {} uname user gname wheel devmajor 0 devminor 0}
47
48
49       ::tar::untar tarball args
50              Extracts  tarball. -file and -glob limit the extraction to files
51              which exactly match or pattern  match  the  given  argument.  No
52              error  is  thrown if no files match. Returns a list of filenames
53              extracted and the file size. The size will be null for non regu‐
54              lar  files.  Leading  path seperators are stripped so paths will
55              always be relative.
56
57              -dir dirName
58                     Directory to extract to. Uses pwd if none is specified
59
60              -file fileName
61                     Only extract the file with this name. The name is matched
62                     against the complete path stored in the archive including
63                     directories.
64
65              -glob pattern
66                     Only extract files patching this glob style pattern.  The
67                     pattern  is  matched  against the complete path stored in
68                     the archive.
69
70              -nooverwrite
71                     Dont overwrite files that already exist
72
73              -nomtime
74                     Leave the file modification  time  as  the  current  time
75                     instead of setting it to the value in the archive.
76
77              -noperms
78                     In  Unix, leave the file permissions as the current umask
79                     instead of setting them to the values in the archive.
80
81
82       % foreach {file size} [::tar::untar tarball.tar -glob *.jpg] {
83       puts "Extracted $file ($size bytes)"
84       }
85
86
87       ::tar::get tarball fileName
88              Returns the contents of fileName from the tarball
89
90
91              % set readme [::tar::get tarball.tar doc/README] {
92              % puts $readme
93              }
94
95
96       ::tar::create tarball files args
97              Creates a new tar file containing the files. files must be spec‐
98              ified as a single argument which is a proper list of filenames.
99
100              -dereference
101                     Normally create will store links as an actual link point‐
102                     ing at a file that may or may not exist in  the  archive.
103                     Specifying  this  option will cause the actual file point
104                     to by the link to be stored instead.
105
106
107       % ::tar::create new.tar [glob -nocomplain file*]
108       % ::tar::contents new.tar
109       file1 file2 file3
110
111
112       ::tar::add tarball files args
113              Appends files to the end of the existing tarball. files must  be
114              specified  as  a single argument which is a proper list of file‐
115              names.
116
117              -dereference
118                     Normally add will store links as an actual link  pointing
119                     at a file that may or may not exist in the archive. Spec‐
120                     ifying this option will cause the actual file point to by
121                     the link to be stored instead.
122
123
124       ::tar::remove tarball files
125              Removes files from the tarball. No error will result if the file
126              does not exist in the tarball. Directory  write  permission  and
127              free  disk  space equivalent to at least the size of the tarball
128              will be needed.
129
130              % ::tar::remove new.tar {file2 file3}
131              % ::tar::contents new.tar
132              file3
133
134

BUGS, IDEAS, FEEDBACK

136       This document, and the package it describes, will  undoubtedly  contain
137       bugs and other problems.  Please report such in the category tar of the
138       Tcllib  SF  Trackers  [http://sourceforge.net/tracker/?group_id=12883].
139       Please  also  report any ideas for enhancements you may have for either
140       package and/or documentation.
141

KEYWORDS

143       archive, tape archive, tar
144
145
146
147tar                                   0.4                               tar(n)
Impressum