Wanting to find for files except for those, that are in /home directory (directly or in one of subdirectories of any level), I run the following command:
find / ! -path '/home/*'
However, I get error messages with "Permission Denied" message, like the following:
find: '/home/user/here/is/some/file': Permission denied
I don't care that it is "permission denied" per se, what I don't like is that it even tries to search there.
At first I thought that could be because there is some symbolic link from other places on FS, that references a directory inside /home/user/, but then I tried with -H option like this:
find -H / ! -path '/home/*'
and it still listed those files/directories inside /home/*.
Any ideas, how to rectify that?
/home
. Here, it would be relatively simple to do, but the pattern could be something like/home/*x
, which requires looking at every file, and there could be a more complex set of conditions (and actions) than just a single-path
. – ilkkachu Dec 05 '20 at 20:55