[Tutor] tar a directory

Alan Gauld alan.gauld at yahoo.co.uk
Fri Nov 4 05:54:22 EDT 2016


On 03/11/16 17:56, Bill Nolf wrote:

> Test 4
> 
> archive = tarfile.open("test.tgz", "a:gz")
> archive.add=(dirarchive, arcname="test")
> archive.close()
> 
> Create a gzip file called test.tgz in the current directory, which is close
> but no cigar
> What I would like is the following gzip file:
> 
> /a/b/c/archive.tgz

So why not:

archive = tarfile.open("/a/b/c/archive.tgz", "a:gz")

or is that too obvious?

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos




More information about the Tutor mailing list