Mar*_*cka 8 windows compression command-line 7-zip
我想压缩文件夹C:\Temp但没有特定的子文件夹(例如C:\Temp\test)。我怎样才能用 7zip 做到这一点?
我想出了以下命令:
c:\Temp>7zip a -t7z test.7z c:\temp\ -mx0 -x!c:\temp\test\*
Run Code Online (Sandbox Code Playgroud)
但它不起作用,因为输出是:
7-Zip (A) 9.20 Copyright (c) 1999-2010 Igor Pavlov 2010-11-18
Scanning
Updating archive test.7z
Compressing Temp\admin.PNG
Compressing Temp\test\admin2.PNG <<<<<< this file should not be added to the archive
Compressing Temp\first.txt
Run Code Online (Sandbox Code Playgroud)
在我的系统上测试:
7zip a -t7z -mx0 -x!test\* test.7z c:\temp\
Run Code Online (Sandbox Code Playgroud)
如果您在源目录中,则文件以相对路径存储,因此测试文件夹看起来像test\file1.txt,而不是c:\temp\test\file1.txt.
请注意,使用 -mx0 开关,您不会压缩文件,只会将它们完整地复制到存档中。