如何在所有子目录中压缩某些文件类型? [英] How to tar certain file types in all subdirectories?

查看:68
本文介绍了如何在所有子目录中压缩某些文件类型?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想压缩目录及其子目录中的所有.php和.html文件.如果我使用

I want to tar and all .php and .html files in a directory and its subdirectories. If I use

tar -cf my_archive *

它将所有文件压缩,我不需要.如果我使用

it tars all the files, which I don't want. If I use

tar -cf my_archive *.php *.html

它忽略子目录.如何递归使它成为tar,但仅包含两种类型的文件?

it ignores subdirectories. How can I make it tar recursively but include only two types of files?

推荐答案

find ./someDir -name "*.php" -o -name "*.html" | tar -cf my_archive -T -

这篇关于如何在所有子目录中压缩某些文件类型?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆