html文件压缩后,将当前目录下的所有HTML文件压缩在一起

尝试

find . -type f -name "*.html" | xargs zip all-html-files

你也可以说

find . -type f -name "*.html" | zip all-html-files -@

如果您不想保留目录结构,请指定-j选项:

find . -type f -name "*.html" | zip -j all-html-files -@

man 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. For example,

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

(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).

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值