In my Mac, when I open terminal, how would I go about listing all files within a directory and subs that are NON-readonly?
The readonly part is the one i’m not sure on.
Thanks.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
First define or decide what ‘NON-readonly’ means. Is a file that’s executable not readonly? What about a file that has no permissions (it isn’t readonly, but it isn’t readable either).
Second, use
findwith appropriate options (-perm, maybe-maxdepth) to generate the list of files, and then executegrep:The
+is a recent but useful innovation. If it is not available, you could use GNUfindand its-print0piped to GNUxargs -0instead, but GNUfindsupports the+notation anyway. If you don’t have GNUfindand GNUxargs, you may have to use plain-printandxargs, but that doesn’t properly handle file names with oddball characters (spaces, newlines in particular) in the names.