yield tarinfo
args = sys.argv[1:]
if len(args) > 1:
    tar = tarfile.open(args[0])
path = args[2] if len(args) > 2 else '.'
tar.extractall(path, get_members(tar, args[1]))
Extract all files with directory path in given directory