[英]How to get notified if there is any changes in file system in USB device in linux or how to use recursively inotify
[英]any way to use linux command file recursively?
我使用这个非常有用的命令:
file *
获取列出文件的质量/身份。
但我想从给定的文件夹中递归地列出。
换句话说,做这样的事情:
(下面的命令不存在)
file * -r
有什么诀窍吗?
您可以使用find
,使用-exec
开关:
find ./ -type f -exec file {} \;
另一种选择是使用 xargs(1):
find . | xargs file
样品 output:
./.config/xfe: directory
./.config/xfe/xfirc: ASCII text
./.Xauthority: X11 Xauthority data
./line/serialLG1800.py: Python script, ...
如果文件名包含空格或其他特殊字符,最好使用 -print0 选项进行查找,这样做还必须为 xargs 添加 -0 选项:
find . -print0 | xargs -0 file
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.