PyDocs

Nav

Data Compression and Archiving

TarFile.add

tarfile

method of TarFile (source)
  • TarFile.add(name, arcname=None, recursive=True, *, filter=None)
Add the file 'name' to the archive. 'name' may be any type of file
(directory, fifo, symbolic link, etc.). If given, 'arcname'
specifies an alternative name for the file in the archive.
Directories are added recursively by default. This can be avoided by
setting 'recursive' to False. 'filter' is a function
that expects a TarInfo object argument and returns the changed
TarInfo object, if it returns None the TarInfo object will be
excluded from the archive.
Changed in 3.2, 3.7
  • 3.2: Added the filter parameter.
  • 3.7: Recursion adds entries in sorted order.
0 Examples
No examples for tarfile/TarFile.add.
See Also
No see-alsos for tarfile/TarFile.add
0 Notes
No notes for TarFile.add