如何使用bash脚本从zip文件中删除目录?


Answers:


18

来自man zip

      zip -d foo foo/tom/junk foo/harry/\* \*.o

will  remove  the  entry  foo/tom/junk,  all  of  the  files  that  start  with
foo/harry/,  and  all  of  the files that end with .o (in any path).

如果这样做没有帮助,您能否提供一些有关您尝试过的命令和输出的详细信息?


12

如果要删除特定目录中的所有文件,可以执行以下操作:

zip --delete file.zip "assets/*"

0

也许可以使用脚本来完成,但是如果要从zip文件中删除目录,请在命令行中确保目录为空。如果目录不为空,则首先从目录中删除所有文件。然后,您可以删除目录。


你能给命令行吗?请编辑您的答案
damadam
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.