linux找到修剪 [英] linux find prune
本文介绍了linux找到修剪的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图排除两个目录;vntvdone 和下载,但由于某种原因,我的命令仍然进入那里并输出其中的文件:
I am trying to exclude two directories; vntvdone and downloading, but for some reason, my command still goes in there and outputs the file within it:
find -name '*.avi' -o -name '*.mkv' -o -name '*.mp4' -o -name '*.VOB' -o -path './downloading' -prune -o -path './vntvdone' -prune
我也遇到了一些问题,如果其中包含 .mp4 的文件夹/目录也被视为文件...我们如何仅搜索文件而不搜索文件夹?
I am also running into problems where if a folder/directory that has .mp4 in it, it also gets treated as a file as well... how can we do this search only for files and not folders?
推荐答案
我发现它更易于使用!而不是使用 prune
.我假设 find 的起始路径是 '.'该示例省略了它.
I find it easier to use ! than use prune
. I've assumed the starting path for find is '.' The example omits it.
find . \( -type d -a ! -name 'downloading' -a ! -name 'vntdone' -a ! -name '.' \) -o -name \*.avi -o -name \*.mkv -o -name \*.mp4 -o -name \*.VOB
这篇关于linux找到修剪的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文