linux find prune

你离开我真会死。 提交于 2019-12-24 13:34:00

问题


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

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?


回答1:


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 


来源:https://stackoverflow.com/questions/15565660/linux-find-prune

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!