Deleting files inside a zip file on Linux

Sometimes when we’re working with zip files, we need to remove some files inside it to doesn’t override another files during extraction. Linux has a special app to this, we’re talking about zip.

Debian based distros like Ubuntu, Mint, etc., already have this program installed, CentOS for instance doesn’t have installed, so, to install it you will do this:

To those distros, the way to use zip app it’s the same.

Deleting specific files inside a zip file

If you want to delete one or more specific files, you can do this:

Like /bin/rm command, this app also can receive N parameters on –delete arg.

If you want to delete directories inside a zip file, it is the almost same way, but you will add “/*” at the end of string arg. Bellow you have an example of it:

Pay attention to the last parameter, “directory3/sub-folder/*”, in this case, the folder “sub-folder” will be deleted from “directory3” folder.

Be happy : )