Zip multiple files one by one

December 2016


Zip multiple files one by one




Issue


I want a hundred zip files in a directory one by one.
such that:
foreach dir *. img do in zip $ 1.zip 

Solution


There is the right command line;
lami20j@debian-acer:~$ ls *.img
a10.img  a1.img  a2.img  a3.img  a4.img  a5.img  a6.img  a7.img  a8.img  a9.img
lami20j@debian-acer:~$ ls *.img | zip archive_img -@
  adding: a10.img (stored 0%)
  adding: a1.img (stored 0%)
  adding: a2.img (stored 0%)
  adding: a3.img (stored 0%)
  adding: a4.img (stored 0%)
  adding: a5.img (stored 0%)
  adding: a6.img (stored 0%)
  adding: a7.img (stored 0%)
  adding: a8.img (stored 0%)
  adding: a9.img (stored 0%)
lami20j@debian-acer:~$ zip -sf archive_img.zip 
Archive contains:
  a10.img
  a1.img
  a2.img
  a3.img
  a4.img
  a5.img
  a6.img
  a7.img
  a8.img
  a9.img
Total 10 entries (0 bytes)
lami20j@debian-acer:~$ file archive_img.zip 
archive_img.zip: Zip archive data, at least v1.0 to extract

Note


Solved by lami20j

Related :

This document entitled « Zip multiple files one by one » from CCM (ccm.net) is made available under the Creative Commons license. You can copy, modify copies of this page, under the conditions stipulated by the license, as this note appears clearly.