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

编程入门 行业动态 更新时间:2024-10-26 20:29:53
本文介绍了递归查找具有特定扩展名的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在尝试查找具有特定扩展名的文件. 例如,我要查找所有名为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

更多推荐

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

本文发布于:2023-11-02 17:56:30,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1553040.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:递归   扩展名   文件

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!