find 尝试访问不可读的目录,即使它被明确排除
find tries to access unreadable directory even though it is explicitly excluded
这个命令:find $HOME/Dev/missing \( -not -path '/home/filip/Dev/missing/.password-store' \)
returns这个:
/home/filip/Dev/missing
find: ‘/home/filip/Dev/missing/.password-store’: Permission denied
/home/filip/Dev/missing/data-wrangling
但是我排除了无法读取的路径
有没有办法禁用此行为?
虽然您排除了确切路径 .password-store
本身,但 find 仍在寻找进入它的路径(假设它是一个目录)。 -prune
选项在此时停止剪断搜索树,并停止在此路径中进行任何进一步探索。
试试这样的:
find $HOME/Dev/missing -path $HOME/Dev/missing/.password-store -prune -o -print
这个命令:find $HOME/Dev/missing \( -not -path '/home/filip/Dev/missing/.password-store' \)
returns这个:
/home/filip/Dev/missing
find: ‘/home/filip/Dev/missing/.password-store’: Permission denied
/home/filip/Dev/missing/data-wrangling
但是我排除了无法读取的路径
有没有办法禁用此行为?
虽然您排除了确切路径 .password-store
本身,但 find 仍在寻找进入它的路径(假设它是一个目录)。 -prune
选项在此时停止剪断搜索树,并停止在此路径中进行任何进一步探索。
试试这样的:
find $HOME/Dev/missing -path $HOME/Dev/missing/.password-store -prune -o -print