Shell find命令可以找到目录,但find with-exec rm-r无法删除

Shell find命令可以找到目录,但find with-exec rm-r无法删除,shell,unix,find,Shell,Unix,Find,我正在运行这个find命令 find . -mindepth 3 -name [1-9]* -type d 它会返回一组结果 像 现在当我跑步的时候 find . -mindepth 3 -name [1-9]* -type d -exec rm -r {} \; 在同一目录上 find :./B*********/*/output/simulation/9 No such file or directory find :./B********/*/output/simulation/

我正在运行这个find命令

find . -mindepth 3 -name [1-9]* -type d 
它会返回一组结果 像

现在当我跑步的时候

find . -mindepth 3 -name [1-9]* -type d -exec rm -r {} \; 
在同一目录上

find :./B*********/*/output/simulation/9  No such file or directory
find :./B********/*/output/simulation/8    No such file or directory
find :./B********/*/output/simulation/7    No such file or directory
find :./B********/*/output/simulation/5    No such file or directory
find :./B********/*/output/simulation/6    No such file or directory
find :./B********/*/output/simulation/4    No such file or directory
你知道怎么回事吗


p.S为了保密起见,我使用*隐藏文件名

尝试此查找,并在
{}
周围加上引号:

find . -mindepth 3 -name [1-9]* -type d -exec rm -rf '{}' \;

您希望
[1-9]*
由shell处理,而不是由shell处理,因此需要引用它,否则可能会得到不准确的输出,
find-mindepth 3-名称'[1-9]*'-类型d-exec rm-r{}\是否存在任何实际导致此问题的shell设置?另外,可能值得删除命令中的
-f
,这样OP就不会意外地执行它,并且变得迅速
rm
rm-r{}
也不会提示用户,如果这是OP想要的,那么他/她将需要
rm-ir{}
find . -mindepth 3 -name [1-9]* -type d -exec rm -rf '{}' \;