简体   繁体   English

列出目录和子目录中的所有xml文件

[英]list all xml files within a directory and subdirectory

I want to list all .xml files in a dir and its subdir. 我想在dir及其子目录中列出所有.xml文件。 I tried ls -LR but not able to filter out other files apart from .xml.. 我试过ls -LR但是不能过滤除.xml以外的其他文件..

I want something like ls -LR | 我想要像ls -LR |这样的东西 grep *.xml . grep * .xml。

Thanks! 谢谢!

您可以使用find命令:

find . -type f -name '*.xml'

Since you tagged the question with bash: 由于您使用bash标记了问题:

shopt -s extglob globstar
ls !(exclude.this.dir)/**/*.xml

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

相关问题 将目录中的所有文件复制到linux中的本地子目录 - Copy all files in a directory to a local subdirectory in linux 使用python程序重命名linux目录中的所有XML文件 - Using a python program to rename all XML files within a linux directory Bash将基于列表的多个子目录(包括文件)移动到目标目录 - Bash move multiple subdirectory (including files) based on a list to a targe directory 对目录中的所有文件执行命令 - Execute a command on all the files within a directory 如何在列表中查找包含使用部分名称的目录和子目录中的所有文件,然后将它们复制到新文件夹 - How to find all files in a directory and subdirectories that contain using partial names within a list then copy them to a new folder 移动所有文件在特定子目录中 - Move all files in certain subdirectory 打印当前目录子目录中以 .c 结尾的所有(非隐藏)文件 - print all(non-hidden)files in subdirectory of current directory that end with .c 在 Home 目录中使用 ls 命令列出 Home 子目录中的文件 - Linux - Using ls command to list files in subdirectory of Home while in Home directory - Linux 无法列出$ HOME目录中的所有文件 - Unable to list all files in $HOME directory 列出所有子目录中所有文件的文件、所有者和目录 - List files, owner, and directory of all files in all subdirectories
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM