-2

There are questions with answers about how to find all of the writable files with find command, but I do not know how to invert this, and I cannot find questions asking how to find unwritable files. The only answer brought to light directly addressing this is for Linux and does not work on MacOS. Hence, this question can fairly safely be considered unique.

Karatekid430
  • 940
  • 11
  • 25
  • Could you reference some of your search results? Furthermore, how your search looks like currently? Nevertheless, does [How do I find all files and directories writable by a specific user?](https://serverfault.com/a/17406/448950) answer your question and using the NOT operator `!` or [`-not`](https://stackoverflow.com/questions/1341467/) fulfill your requirement? – U880D Jun 12 '23 at 08:05
  • 1
    That does not work, it results in `find: -writable: unknown primary or operator`. – Karatekid430 Jun 12 '23 at 08:10
  • Since it does work in my environment out-of-box, maybe you can provide more description and information regarding yours and your search. You might also take advantage from [How to ask](https://stackoverflow.com/help/how-to-ask). – U880D Jun 12 '23 at 08:16
  • 3
    @Karatekid430 Then the problem you're having isn't about finding writable vs nonwritable files, it's about the version of `find` you have not supporting the `-writable` primary. You should edit your question (and the title) to clarify this, and also include info about what version of `find` you have (or at least what OS you're using, which would help clarify that). – Gordon Davisson Jun 12 '23 at 08:18

1 Answers1

3

This should find all files unwritable with the current user recursively

find . \! -perm -u=w
Philippe
  • 20,025
  • 2
  • 23
  • 32