|
@@ -22,6 +22,7 @@ def compress_file_tar(file_path, output_filename):
|
|
|
# 创建一个 tarfile 对象,使用 'w:gz' 模式表示写入 gzip 压缩的 tar 包
|
|
|
with tarfile.open(output_filename, "w:gz") as tar:
|
|
|
# 将文件添加到 tar 包中,arcname 指定在 tar 包中的相对路径
|
|
|
+ tar.format = tarfile.GNU_FORMAT
|
|
|
tar.add(file_path, arcname=file_path)
|
|
|
|
|
|
def compress_tar(folder_path, output_filename):
|