在 Unix 上查找不以特定扩展名结尾的文件名? [英] find filenames NOT ending in specific extensions on Unix?

查看:16
本文介绍了在 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 find,虽然功能强大,但似乎没有 exclude 模式(或者我错过了它),而且我一直发现很难使用正则表达式查找与特定表达式匹配的事物.

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 环境中(使用大多数 GNU 工具的 GnuWin32 端口),所以我'm 对仅限 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆