zip error - Nothing to do

To create a zipfile:

  • From a list of files, zip myZippedImages.zip alice.png bob.jpg carl.svg. You need to specify both

    • the zipfile (output), and
    • the files you will zip (input).
  • From a folder, zip -r myZippedImages.zip images_folder


To make it clearer than Alex's answer, to create a zip file, zip takes in a minimum of 2 arguments. How do I know, because when you use man zip, you get its man page, part of which is:

zip  [-aABcdDeEfFghjklLmoqrRSTuvVwXyz!@$] [--longoption ...]  [-b path]
       [-n suffixes] [-t date] [-tt date] [zipfile [file ...]]  [-xi list]

and when you typed zip in the command line, you get:

zip [-options] [-b path] [-t mmddyyyy] [-n suffixes] [zipfile list] [-xi list]

In both cases, notice [zipfile list] or [zipfile [file ...]]. The square brackets indicate something being optional. If you're not saving to a zipfile, then the list argument is not required.

If you want to save into a zipfile (choosing the [zipfile list] option, you need to also provide list, because it is within the square brackets. For this reason, I prefer the output of zip instead of man zip. (The man page might be confusing)


The issue is that you have not provided a name for the zip-files it will create.

find /home/user/rep/tests/data/archive/* -maxdepth 0 -type d -exec zip -r "{}" "{}" \;

This will create separate zipped directories for each of the subfolders tmp tmp_dkjg and tmp_dsf


If you used zip command on a zip file you will see that error. make sure you are using zip on none zip version file, otherwise use unzip

Tags:

Shell

Bash