我试图/zones
在我的find
命令中排除该目录。我没有 GNU find 可用,只有本机 Solaris find
。
我试过这样的事情:
find / -type d ! -name zones
Run Code Online (Sandbox Code Playgroud)
问题是,有了这个排除,我也会丢失像/etc/zones
.
有没有办法指定完整的目录名称,如:
find / -type d ! -name ^\/zones
Run Code Online (Sandbox Code Playgroud)
我已经测试了很多方法,但我不能/
在字符串前面包含。
这是一种便携式方式:
find / -type d -exec test {} = /zones \; -prune -o -type d -print
Run Code Online (Sandbox Code Playgroud)
请注意,根据您使用的 Solaris 发行版(如/usr/sfw/bin/gfind
、/usr/gnu/bin/find
、...),GNU find 可能在备用目录中可用。