how can i search for files and zip them in one zip file

前端 未结 3 687
走了就别回头了
走了就别回头了 2021-01-31 15:12

I tried to search files and zip them with the following commmand

find . regexpression -exec zip {} \\;

however it is not working. How can i do

3条回答
  •  南旧
    南旧 (楼主)
    2021-01-31 16:01

    The command you use will run zip on each file separately, try this:

    find . -name  -print | zip newZipFile.zip -@
    

    The -@ tells zip to read files from the input. From man zip(1),

    -@ 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.

提交回复
热议问题