查找在Unix上没有以特定扩展名结尾的文件名? [英] find filenames NOT ending in specific extensions on Unix?
问题描述
是否有一种简单的方法来递归地查找目录层次结构中的所有文件,而不是以扩展名列表结尾?例如。所有不是* .dll或* .exe的文件
Is there a simple way to recursively find all files in a directory hierarchy, that do not end in a list of extensions? E.g. all files that are not *.dll or *.exe
UNIX / GNU查找,尽管功能强大,但似乎没有排除
模式(或者我想念它),我一直发现很难使用正则表达式来查找不与特定表达式匹配的内容。
UNIX/GNU find, powerful as it is, doesn't seem to have an exclude
mode (or I'm missing it), and I've always found it hard to use regular expressions to find things that don't match a particular expression.
我在Windows环境中(使用 GnuWin32 大多数GNU工具的端口),因此我同样欢迎使用仅限Windows的解决方案。
I'm in a Windows environment (using the GnuWin32 port of most GNU tools), so I'm equally open for Windows-only solutions.
推荐答案
或者不带(
和需要对其进行转义:
Or without (
and the need to escape it:
find . -not -name "*.exe" -not -name "*.dll"
,并同时排除目录列表
find . -not -name "*.exe" -not -name "*.dll" -not -type d
或采用正逻辑;-)
find . -not -name "*.exe" -not -name "*.dll" -type f
这篇关于查找在Unix上没有以特定扩展名结尾的文件名?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!