Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python tar a directory

import tarfile
import os.path

def make_tarfile(output_filename, source_dir):
    with tarfile.open(output_filename, "w:gz") as tar:
        tar.add(source_dir, arcname=os.path.basename(source_dir))
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #python #tar #directory
ADD COMMENT
Topic
Name
8+4 =