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