1

I can't find a way to zip all file inside a folder without the folder itself

-tempfolder
--images
---1.jpg
---2.jpg
---3.jpg

I need to zip all files inside images folder without creating the folder once I extract them following this answer ( and others ) I did try this way but without success zip: Argument list too long (80.000 files in overall)

find images/ -mindepth 1 -maxdepth 1 | zip images/images.zip -@

when I extract files from zip it generate the images folders with all the files inside

al404IT
  • 117

1 Answers1

1

Try it this way:

find images/ -mindepth 1 -maxdepth 1 | xargs -l 1000 zip images/images.zip

The xargs program will take the stdout from the "|" pipe and add them as command line arguments. The -l option limits the number of files expanded at a time to 1000.

EDIT

It seems that for the poster the argument list was too long because the folder path was appended to each of the files, so inflating the list size by a large factor.

In his case the solution was to add the argument of -j or --junk-paths, to store just the name of the file (junk the path), to not add directory names. So the following was enough:

find images/ -mindepth 1 -maxdepth 1 | zip images/images.zip -@ -j
harrymc
  • 498,455