[英]How to zip all txt files recursively in linux using zip?
I want to zip
all .txt
files in using zip
command in linux
recursively.我想在linux
中使用zip
命令递归zip
所有.txt
文件。 For this, I'm using:为此,我正在使用:
zip -r /home/folder/zipName /home/folder2/subfolder1/*.txt
and it is giving me the below error:它给了我以下错误:
zip warning: missing end signature--probably not a zip file (did you
zip warning: remember to use binary mode when you transferred it?)
zip warning: (if you are trying to read a damaged archive try -F)
zip error: Zip file structure invalid
use用
zip -r /home/folder/zipName /home/folder2/subfolder1 -i \*.txt
it will do what you expected.它会做你所期望的。
这对我有用...
zip -r /home/folder/zipName /home/folder2/subfolder1/**/*.txt
I had the same error, and I found that the solution was to make sure that your zipName
ends in .zip
.我遇到了同样的错误,我发现解决方案是确保您的zipName
以.zip
结尾。 Putting this here in case it can help somebody else.把它放在这里以防它可以帮助其他人。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.