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

UAd*_*ter 30 command-line

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

l0b*_*0b0 27

来自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).
Run Code Online (Sandbox Code Playgroud)

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


小智 21

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

zip --delete file.zip "assets/*"
Run Code Online (Sandbox Code Playgroud)