有没有办法指定包含创建 zip 时要包含的文件的输入文件?
Is there a way to specify an input file containing the files to include when creating a zip?
我有一个文件路径列表,是通过我编写的脚本收集的。这些路径有几千条。有没有办法将它们存储在输入文件中,然后在创建 zip 时传递给 zip
?
来自手册页:
-@ 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.
所以你可以这样做:
zip file.zip -@ < file_containing_list_of_paths
您甚至不需要该文件,您可以直接通过管道传输到 zip
。手册页中的示例是:
find . -name "*.[ch]" -print | zip source -@
我有一个文件路径列表,是通过我编写的脚本收集的。这些路径有几千条。有没有办法将它们存储在输入文件中,然后在创建 zip 时传递给 zip
?
来自手册页:
-@ 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.
所以你可以这样做:
zip file.zip -@ < file_containing_list_of_paths
您甚至不需要该文件,您可以直接通过管道传输到 zip
。手册页中的示例是:
find . -name "*.[ch]" -print | zip source -@