7zip CLI 白名单文件以按扩展名添加 [英] 7zip CLI whitelist files to add by extension

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

问题描述

如果我正在运行 7z a -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 白名单文件以按扩展名添加的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆