Відповіді:
Якщо ви хочете весь каталог, ви можете просто використовувати -rперемикач:
zip -r -s 200M myzip photos_test
Це буде включати всі підкаталоги, photos_testхоча.
find photos_test/ -mindepth 1 -maxdepth 1 | zip -@ -s 200M
find . -mindepth 1 -maxdepth -name '*.json' | zip {YOURZIPFILENAME}.zip -@якщо вам не потрібно розділяти і хочете вибирати файли за розширенням.
ls photos_test | zip -s 200M -@ photos
-@змусить zip прочитати список файлів із stdin|будеш конвеєр вихід з lsв вхід з zipкомандиman zip:
USE ⋮ -@ file lists. If a file list is specified as -@ [Not on MacOS], zip takes the list of input files from standard input instead of from the command line. For example, zip -@ foo will store the files listed one per line on stdin in foo.zip. Under Unix, this option can be used to powerful effect in conjunction with the find (1) command. For example, to archive all the C source files in the current directory and its subdirectories: find . -name "*.[ch]" -print | zip source -@ (note that the pattern must be quoted to keep the shell from expanding it). ⋮
-bash: /usr/bin/zip: Argument list too longможе спричинити у випадку: 1- через те, що не використовується-rперемикач, 2- є занадто багато файлів для архівації. Отже, у першому випадку відповідь @ Mat відповідає дійсності, а у другому - відповідь @ IgnacioVazquez-Abrams.