[Tutor] Fwd: Re: tar a directory

Alan Gauld alan.gauld at yahoo.co.uk
Fri Nov 4 08:30:31 EDT 2016


Always use reply-all or reply-list when responding to tutor posts....

==============================

The archive file changes each time so I need to set a variable based on the changing directory

Sent from my iPhone

> On Nov 4, 2016, at 5:54 AM, Alan Gauld via Tutor <tutor at python.org> wrote:
> 
>> 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
> 
> 
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> To unsubscribe or change subscription options:
> https://mail.python.org/mailman/listinfo/tutor






More information about the Tutor mailing list