On this page:
tar
tar->output
tar-gzip

6 tar File Creation

 (require file/tar) package: base
The file/tar library provides utilities to create archive files in USTAR format, like the archive that the Unix utility pax generates. The USTAR format imposes limits on path lengths. The resulting archives contain only directories, files, and symbolic links, and owner information is not preserved; the owner that is stored in the archive is always “root.”
Symbolic links (on Unix and Mac OS X) are not followed, and the path in a link must be less than 100 bytes.

procedure

(tar tar-file    
  path ...    
  [#:path-prefix path-prefix])  exact-nonnegative-integer?
  tar-file : path-string?
  path : path-string?
  path-prefix : (or/c #f path-string?) = #f
Creates tar-file, which holds the complete content of all paths. The given paths are all expected to be relative paths for existing directories and files (i.e., relative to the current directory). If a nested path is provided as a path, its ancestor directories are also added to the resulting tar file, up to the current directory (using pathlist-closure).

If path-prefix is not #f, then it is prefixed to each path in the archive.

procedure

(tar->output paths 
  [out 
  #:path-prefix path-prefix]) 
  exact-nonnegative-integer?
  paths : (listof path?)
  out : output-port? = (current-output-port)
  path-prefix : (or/c #f path-string?) = #f
Packages each of the given paths in a tar format archive that is written directly to the out. The specified paths are included as-is (except for adding path-prefix, if any); if a directory is specified, its content is not automatically added, and nested directories are added without parent directories.

procedure

(tar-gzip tar-file    
  paths ...    
  [#:path-prefix path-prefix])  void?
  tar-file : path-string?
  paths : path-string?
  path-prefix : (or/c #f path-string?) = #f
Like tar, but compresses the resulting file with gzip.