Bash – Create Zip Archive Without File Extension Using ‘zip’ Command

bashcommand linezip

Normally, to zip a directory, I can do something like this:

zip -r archive.zip directory/

However, if I try to remove the extension from archive.zip like this:

zip -r archive directory/

It implicitly appends the .zip extension to the output. Is there a way to do this without creating a .zip and then renaming it?

I'm using this version of zip on Ubuntu 18.04:

Copyright (c) 1990-2008 Info-ZIP - Type 'zip "-L"' for software license.
This is Zip 3.0 (July 5th 2008), by Info-ZIP.

Best Answer

The -A (--adjust-sfx) option causes zip to treat the given archive name as-is:

zip -Ar archive directory/

This works even when archive isn’t created as a self-extracting archive.

Related Question