[Tutor] compress directory

Ben Finney ben+python at benfinney.id.au
Thu Nov 3 14:19:31 EDT 2016


Bill Nolf <bnolf at cox.net> writes:

> How do I compress (gzip and/or tar) a directory in python?  I found
> examples of compressing a file using gzip or tar but not a directory. 

The Python standard library <URL:https://docs.python.org/3/library/>
contains implementations of many common tools. It's well worth searching
there first if you need something to do with data structures, protocols,
or file formats.

In this case, yes, there are several archive formats supported
<URL:https://docs.python.org/3/library/archiving.html>.

-- 
 \        “Most people, I think, don't even know what a rootkit is, so |
  `\     why should they care about it?” —Thomas Hesse, Sony BMG, 2006 |
_o__)                                                                  |
Ben Finney



More information about the Tutor mailing list