Add a "archive_tree" in the tarfile module

Hello, It happened to me several time : re-write a small function to archive a directory, to mimic "tar -xzvf archive.tgz directory" What about adding in tarfile this small function: def archive_tree(archive_name, src_dir [[, add_empty_dir], callable]) -> creates an archive that contains the files in directory, by recursively walking into it. if add_empty_dir is set to False (default: True), empty directory founded will not be added if callable is provided, it will be triggered everytime a file is added in the archive and will return True or False If False, the file will not be added regards Tarek -- Tarek Ziadé | http://ziade.org

On Sun, May 17, 2009, Tarek Ziad? wrote:
It happened to me several time : re-write a small function to archive a directory, to mimic "tar -xzvf archive.tgz directory"
Given that you already have this code, please upload to bugs.python.org (possibly also PyPI and/or Cookbook) so it doesn't get lost. -- Aahz (aahz@pythoncraft.com) <*> http://www.pythoncraft.com/ "In 1968 it took the computing power of 2 C-64's to fly a rocket to the moon. Now, in 1998 it takes the Power of a Pentium 200 to run Microsoft Windows 98. Something must have gone wrong." --/bin/fortune

On Sun, May 17, 2009, Tarek Ziad? wrote:
It happened to me several time : re-write a small function to archive a directory, to mimic "tar -xzvf archive.tgz directory"
Given that you already have this code, please upload to bugs.python.org (possibly also PyPI and/or Cookbook) so it doesn't get lost. -- Aahz (aahz@pythoncraft.com) <*> http://www.pythoncraft.com/ "In 1968 it took the computing power of 2 C-64's to fly a rocket to the moon. Now, in 1998 it takes the Power of a Pentium 200 to run Microsoft Windows 98. Something must have gone wrong." --/bin/fortune
participants (4)
-
Aahz
-
Mathias Panzenböck
-
Stephen J. Turnbull
-
Tarek Ziadé