Linux 如何递归搜索具有某些扩展名的文件?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5985752/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to recursively search for files with certain extensions?
提问by StackOverflowNewbie
I need to find all the .psd
files on my Linux system (dedicated web hosting). I tried something like this: ls -R *.psd
, but that's not working. Suggestions?
我需要.psd
在我的 Linux 系统(专用网络托管)上找到所有文件。我尝试过这样的事情:ls -R *.psd
,但这不起作用。建议?
采纳答案by onteria_
You can use the following find command to do that:
您可以使用以下 find 命令来执行此操作:
find /path/to/search -iname '*.psd'
iname
does a case insensitive search.
iname
进行不区分大小写的搜索。
回答by jm666
you also can
你也可以
ls ./**/*.psd
but:
但:
- you must have bash version 4+
- you must have
shopt -s globstar
#in your .bashrc or .profile, etc.... - will search case sensitive (or you must set
shopt -s nocaseglob
too)
- 你必须有 bash 版本 4+
- 你必须在
shopt -s globstar
你的 .bashrc 或 .profile 等中#in。 - 将搜索区分大小写(或者您也必须设置
shopt -s nocaseglob
)