UNIX找到找不到以特定扩展名结尾的文件名? [英] UNIX find for finding file names NOT ending in specific extensions?

查看:114
本文介绍了UNIX找到找不到以特定扩展名结尾的文件名?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有一种简单的方法来递归地找到目录层次结构中的所有文件,这些文件是否在扩展列表中结束?例如。所有不是* .dll或* .exe的文件



UNIX / GNU find功能强大,似乎没有排除模式(或者我错过了),而且我一直发现很难使用正则表达式来查找与特定表达式不匹配的内容。 / p>

我在Windows环境中(使用 GnuWin32 <

或者没有和需要转义:

  * .exe-not -name* .dll

,并排除目录列表

  find。-not -name* .exe-not -name* .dll-not -type d 

或正逻辑; - )

  find。 -not -name* .exe-not -name* .dll-type f 


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, 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.

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"

and to also exclude the listing of directories

find . -not -name "*.exe" -not -name "*.dll" -not -type d

or in positive logic ;-)

find . -not -name "*.exe" -not -name "*.dll" -type f

这篇关于UNIX找到找不到以特定扩展名结尾的文件名?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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