递归查找具有特定扩展名的文件

递归查找具有特定扩展名的文件

问题描述:

我正在尝试查找具有特定扩展名的文件. 例如,我要查找所有名为Robert

I'm trying to find files with specific extensions. For example, I want to find all .pdf and .jpg files that's named Robert

我知道我可以执行此命令

I know I can do this command

$ find . -name '*.h' -o -name '*.cpp'

但是我需要指定扩展名之外的文件本身的名称. 我只想看看是否有一种方法可以避免一次又一次地写入文件名 谢谢!

but I need to specify the name of the file itself besides the extensions. I just want to see if there's a possible way to avoid writing the file name again and over again Thank you !

我的偏好:

find . -name '*.jpg' -o -name '*.png' -print | grep Robert