find ~ -path "/home/user/sandboxes/*" -prune -o -name 'some-file.vmdk'
because the default action when no action is supplied is to output the found pathnames. The above pathnames are found, and then those paths are pruned. Pruning a search path does not exclude these pathnames from being printed.
However, if you add
-print to the very end, as in
find "$HOME" -path "$HOME/sandboxes" -prune -o -name 'some-file.vmdk' -print
then those pathnames would not be printed. This is because now you have an explicit action (the
-print), so no default actions are triggered. The
-print only applies to the right hand side of
Note that the
* is not needed, and that the variable
$HOME is easier to work with than
~, especially in scripts.
Your first command,
find ~ -not -path "~/sandboxes/*" -name 'some-file.vmdk'
very likely does not work as
~ is not expanded within quotes.
Assuming you used
$HOME instead, it also does not prune the search path, which means it would still enter
~/sandboxes, but it would never print any pathnames from beneath that path. Since it enters the directory, it would still give you the permission errors when it reaches the inaccessibly directories.