당신이 디렉토리 구조를 유지하지 않으려면
find . -type f -name "*.html" | xargs zip all-html-files
이
또한
find . -type f -name "*.html" | zip all-html-files [email protected]
말할 수보십시오 :
는 경로 정크 -j
옵션을 추가하려면 -j
옵션을 지정하십시오.
find . -type f -name "*.html" | zip -j all-html-files [email protected]
man zip
는 말한다 : 자신의 질문에 표시된 @devnull으로
[email protected] file lists. If a file list is specified as [email protected] [Not on MacOS], zip
takes the list of input files from standard input instead of from the
command line. For example,
zip [email protected] 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 [email protected]
(note that the pattern must be quoted to keep the shell from expanding
it).
-j
--junk-paths
Store just the name of a saved file (junk the path), and do not
store directory names. By default, zip will store the full path
(relative to the current directory).
, 당신은 경로를 정크 할'-j' 추가 할 수 있습니다. – fedorqui
경로에 공백이 있으면 xargs가 여러 인수로 전달합니다. 'find ... |를 사용하십시오. xargs -I {} zip all_html_files.zip "{}"'. args를 잘못 입력하는 것이 쉽기 때문에'zip'에서 강제로'-output-to-this-file'을 사용하는 것이 조금 위험하다는 것을 알았습니다. – jozxyqk