bash zip 错误 - 无事可做
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/40003310/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-08 22:26:06 来源:igfitidea点击:
zip error - Nothing to do
提问by user3378876
I try to zip all folders in given directory. So I wrote this
我尝试压缩给定目录中的所有文件夹。所以我写了这个
find /home/user/rep/tests/data/archive/* -maxdepth 0 -type d -exec zip -r "{}" \;
but got
但得到
zip error: Nothing to do! (/home/user/rep/tests/data/archive/tmp.zip)
zip error: Nothing to do! (/home/user/rep/tests/data/archive/tmp_dkjg.zip)
here is what this contains
这是它包含的内容
user@machine:~$ ls /home/aliashenko/rep/tests/data/archive/
tmp tmp_dkjg tmp_dsf
采纳答案by Alex Telon
The issue is that you have not provided a name for the zip-files it will create.
问题是您没有为它将创建的 zip 文件提供名称。
find /home/user/rep/tests/data/archive/* -maxdepth 0 -type d -exec zip -r "{}" "{}" \;
This will create separate zipped directories for each of the subfolders tmp
tmp_dkjg
and tmp_dsf
这将为每个子文件夹创建单独的压缩目录tmp
tmp_dkjg
和tmp_dsf