Linux 列出目录和子目录中的所有xml文件
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/11042585/
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
提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-06 06:51:47 来源:igfitidea点击:
list all xml files within a directory and subdirectory
提问by user1164061
I want to list all .xml files in a dir and its subdir. I tried ls -LR but not able to filter out other files apart from .xml..
我想列出目录及其子目录中的所有 .xml 文件。我试过 ls -LR 但无法过滤掉除 .xml 之外的其他文件。
I want something like ls -LR | grep *.xml .
我想要类似 ls -LR 的东西 | grep *.xml 。
Thanks!
谢谢!
采纳答案by kev
You can use find
command:
您可以使用find
命令:
find . -type f -name '*.xml'
回答by glenn Hymanman
Since you tagged the question with bash:
由于您用 bash 标记了问题:
shopt -s extglob globstar
ls !(exclude.this.dir)/**/*.xml