By executing the following command you create a deploy.zip in a directory called build, adding every file in the current directory.

zip -r build/deploy.zip *

So far, so good. Now, I want to add a directory in the zip and then add all the files in the current directory.

Basically, instead of having the directory structure like this:

--> all_files_from_current_directory

I need zip like this:

--> root_dir
--> --> all_files_from_current_directory

Any ideas?

  • zip add foo deploy.zip OR zip update foo deploy.zip – linuxdev2013 Jun 1 '18 at 15:54
  • You just have to move up before doing the ZIP. If the directory has the wrong name, you can create a link (Unix) or temporarily rename it (Windows) – xenoid Jun 1 '18 at 17:38

Your Answer

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

Browse other questions tagged or ask your own question.