简体   繁体   English

Bash 查找具有特定扩展名的文件,但排除文件名中具有特定关键字的文件

[英]Bash find files with certain extension, but exclude those with certain keyword in filename

I'm looking to run a search which looks for all files in a certain folder which have the extension of ".exr" and ".dpx".我正在寻找运行搜索以查找某个文件夹中具有“.exr”和“.dpx”扩展名的所有文件。 However, from that list I want to exclude files that contain 'BTY' in the name.但是,我想从该列表中排除名称中包含“BTY”的文件。

I'm not sure how to run this so that it removes the 'BTY' files from the list after searching, here is what I was trying.我不确定如何运行它,以便在搜索后从列表中删除“BTY”文件,这就是我正在尝试的。

find /Users/Tim/Downloads -type f -name "*.dpx" -o -name "*.exr" -o ! -type f -name "*BTY*.exr"

Thanks.谢谢。

Try:尝试:

find /Users/Tim/Downloads -type f -name "*.dpx" -o '(' -name "*.exr" -a '!' -name "*BTY*.exr" ')'

Find files named *.dpx or ( named *.exr and not named *BTY*.exr ).查找名为*.dpx或(名为*.exr而未命名为*BTY*.exr )的文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM