30

How do I delete a directory from a zip file using a bash script?

27

From 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).

If that doesn't help, can you provide some details about the commands you've tried and the output?

20

If you want to delete all files from a specific dir, you could do this:

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

Maybe it could be done with a script, but in command line if you want to delete a directory from the zip file, make sure the directory is empty. If the directory is not empty, then first delete all the files from the directory. Then you can able to delete the directory.

1
  • Can you give command lines? Please edit your answer – damadam Nov 22 '19 at 13:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.