[New-bugs-announce] [issue6818] remove/delete method for zipfile/tarfile objects

Ross report at bugs.python.org
Wed Sep 2 06:42:12 CEST 2009


New submission from Ross <rossmclendon at tamu.edu>:

It would be most helpful if a method could be included in the TarFile
class of the tarfile module and the ZipFile class of the zipfile module
that would remove a particular file (either given by a name or a
TarInfo/ZipInfo object) from the archive.

Usage to remove a single file from an archive would be as follows:

import zipfile
zipFileObject = zipfile.ZipFile(archiveName,'a')
zipFileObject.remove(fileToRemove)
zipFileObject.close()

Such a method should probably only apply to archives that are in append
mode as write mode would erase the original archive and read mode should
render the archive immutable.

One possible extra to be included is to allow a list of file names or
ZipInfo/TarInfo objects to be passed into the remove method, such that
all items in the list would be removed from the archive.

----------
components: Library (Lib)
messages: 92154
nosy: rossmclendon
severity: normal
status: open
title: remove/delete method for zipfile/tarfile objects
type: feature request
versions: Python 3.2

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue6818>
_______________________________________


More information about the New-bugs-announce mailing list