I'm trying to filter out files using find, however am having difficulty. Does anyone know the correct command to filter out "Untitled.rtf" using file permissions? BSD like?
-rwxr-xr-x@ 1 X staff 368 Jan 24 03:02 Untitled.rtf* -rw------- 1 X staff 0 Jan 24 02:37 t -r-------- 1 X staff 0 Jan 24 02:40 t2 drwx------ 2 X staff 64 Jan 24 02:52 t3/ I can find the file I want to filter out:
$ find . \( -perm -g+r -o -perm -g+w -o -perm -g+x -o -perm -o+r -o -perm -o+w -o -perm -o+x \) -exec ls -l {} \; -rwxr-xr-x@ 1 X staff 368 Jan 24 03:02 ./Untitled.rtf Now, I try this find command using ! (NOT) and -a (AND), however it doesn't work as intended to remove Untitled.rtf from the resulting list:
$ find . \( -perm -000 -a ! \( -perm -g+r -o -perm -g+w -o -perm -g+x -o -perm -o+r -o -perm -o+w -o -perm -o+x \) \) -exec ls -l {} \; -rwxr-xr-x@ 1 X staff 368 Jan 24 03:02 Untitled.rtf -rw------- 1 X staff 0 Jan 24 02:37 t -r-------- 1 X staff 0 Jan 24 02:40 t2 drwx------ 2 X staff 64 Jan 24 02:52 t3 -r-------- 1 X staff 0 Jan 24 02:40 ./t2 -rw------- 1 X staff 0 Jan 24 02:37 ./t
ls -l .? There is no-typetest.