本文介绍了通过扩展名添加的7zip CLI白名单文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我在7z上运行-tzip myDestFile.zip some/dir命令,并且想要向其添加文件扩展名白名单,例如,如果我输入* .txt * .xls * .doc,它将仅将具有这些扩展名的文件添加到存档中,我该怎么做?该文档在将单个扩展名列入白名单方面做得很好,但是多个扩展名又如何呢?我是否只需要在脚本中多次运行该命令?

If I'm running the 7z a -tzip myDestFile.zip some/dir command and I want to add to it a file extension whitelist, such that if I put *.txt *.xls *.doc, it will only add files with those extensions to the archive, how would I do that? The documentation does well at whitelisting by a single extension, but what about multiple? Am I just going to have to run the command several times in my script?

我尝试了以下操作:

7za a -tzip test.zip ./subdir *.txt *.xlsx # throws error
7za a -tzip test.zip ./subdir -i!./*.txt -i!./*.xlsx # also results in error
7za a -tzip test.zip ./subdir -i!*.txt -i!*.xlsx # also results in error

推荐答案

此问题不应保持打开状态.对我有用的答案如下:

This Question shouldn't remain open. The answer that worked for me is below:

7za a -tzip test.zip ./*.txt ./*.xlsx

这篇关于通过扩展名添加的7zip CLI白名单文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-19 05:40