如何列出一个目录树中的所有二进制文件扩展名? [英] How to list all binary file extensions within a directory tree?
本文介绍了如何列出一个目录树中的所有二进制文件扩展名?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要建立的位于目录树中的二进制文件中的所有文件扩展名的列表。
的主要问题将需要如何区分从一个二进制的文本文件,其余应蛋糕
修改:这是我得到的,更好的想法。
最接近? 找到。型的F | xargs的文件| grep的-v文| sed的-r的:。* \\(。*)\\:*:\\ 1:G'
解决方案
这里有一个窍门,找到二进制文件:
的grep -r -m 1^<您的根> | grep的^二进制文件
该-m 1使grep的不读所有的文件。
I need to build a list of all the file extensions of binary files located within a directory tree.
The main question would need to be how to distinguish a text file from a binary one, and the rest should be cake.
EDIT: This is the closest I got, any better ideas?
find . -type f|xargs file|grep -v text|sed -r 's:.*\.(.*)\:.*:\1:g'
解决方案
Here's a trick to find the binary files:
grep -r -m 1 "^" <Your Root> | grep "^Binary file"
The -m 1 makes grep not read all the file.
这篇关于如何列出一个目录树中的所有二进制文件扩展名?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文