0

I'd like to use GNU find to find sub-directories and files under the current path that either does not have the particular user OR the particular group.

find . -not -user USERXXX -or -not -group GROUPYYY

seems not working.

I can tell that because collecting all unique ownership values with -exec

find . -not -user USERXXX -or -not -group GROUPYYY -exec stat -f '%Su:%Sg' '{}' \; | sort -u

will miss

root:staff
root:GROUPYYY

Any idea why? It seems the user USERXXX is seen by find as root somehow?

  • GNU find 4.9.0.
gfind --version
find (GNU findutils) 4.9.0
Packaged by Homebrew
Copyright (C) 2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by Eric B. Decker, James Youngman, and Kevin Dalley. Features enabled: D_TYPE O_NOFOLLOW(enabled) LEAF_OPTIMISATION FTS(FTS_CWDFD) CBO(level=2)

OS: macOS 14.3.2

Computist
  • 473

0 Answers0