List readonly files
I need to list or show or query for the files in a folder (well, technically, on a USB drive, but I can navigate to it in Finder/Terminal) that are marked readonly.
All the Google-fu in the world just reveals solutions to change permissions but I don't need to do that.
My Dashcam marks videos/images readonly to save them when I press the button on it, but they're still in a folder with a few hundred MOV files, and I need a simple way to filter down to the ones I am looking for.
terminal finder permission
New contributor
Steven Evers is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |
I need to list or show or query for the files in a folder (well, technically, on a USB drive, but I can navigate to it in Finder/Terminal) that are marked readonly.
All the Google-fu in the world just reveals solutions to change permissions but I don't need to do that.
My Dashcam marks videos/images readonly to save them when I press the button on it, but they're still in a folder with a few hundred MOV files, and I need a simple way to filter down to the ones I am looking for.
terminal finder permission
New contributor
Steven Evers is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |
I need to list or show or query for the files in a folder (well, technically, on a USB drive, but I can navigate to it in Finder/Terminal) that are marked readonly.
All the Google-fu in the world just reveals solutions to change permissions but I don't need to do that.
My Dashcam marks videos/images readonly to save them when I press the button on it, but they're still in a folder with a few hundred MOV files, and I need a simple way to filter down to the ones I am looking for.
terminal finder permission
New contributor
Steven Evers is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
I need to list or show or query for the files in a folder (well, technically, on a USB drive, but I can navigate to it in Finder/Terminal) that are marked readonly.
All the Google-fu in the world just reveals solutions to change permissions but I don't need to do that.
My Dashcam marks videos/images readonly to save them when I press the button on it, but they're still in a folder with a few hundred MOV files, and I need a simple way to filter down to the ones I am looking for.
terminal finder permission
terminal finder permission
New contributor
Steven Evers is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
Steven Evers is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
edited 3 hours ago


Nimesh Neema
14.6k43871
14.6k43871
New contributor
Steven Evers is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
asked 3 hours ago
Steven Evers
1161
1161
New contributor
Steven Evers is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
Steven Evers is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
Steven Evers is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |
add a comment |
3 Answers
3
active
oldest
votes
One way is to make use of the -w
option in bash to check if the file is writable or not.
Go into the directory you want to check your files, then enter:
for RO in $(find . -type f);do [ -r "$RO" ] && [ ! -w "$RO" ] && echo $RO;done
(credit to www.unix.com)
New contributor
Yoric is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |
List the files and grep for the read-only pattern:
ls -l | grep '^-r--'
^
symbol indicates start the line.
We are filtering only files here by mentioning ^-
, after that looking only for read permission files by specifying r--
. If you want to filter read & executable permission files, you can use r-x
.
If you want just the filename, you can use below command
ls -l | grep '^-r--' | awk 'NF>1{print $NF}'
Printing the file name using above command works, only if you don't have spaces in file name.
New contributor
BarathVutukuri is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
1
Grepping thels -l
is a smart way to do it, but beware that your files might start with-rw-r--r--
withroot
as the owner, and such files won't be listed, even though they aren't writeable for the user.
– Yoric
3 hours ago
add a comment |
find . -perm -/444 ! -perm /222
searches for all files/folders which are readable (-perm -/444
) but not writable (! -perm /222
).
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "118"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Steven Evers is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fapple.stackexchange.com%2fquestions%2f347110%2flist-readonly-files%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
One way is to make use of the -w
option in bash to check if the file is writable or not.
Go into the directory you want to check your files, then enter:
for RO in $(find . -type f);do [ -r "$RO" ] && [ ! -w "$RO" ] && echo $RO;done
(credit to www.unix.com)
New contributor
Yoric is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |
One way is to make use of the -w
option in bash to check if the file is writable or not.
Go into the directory you want to check your files, then enter:
for RO in $(find . -type f);do [ -r "$RO" ] && [ ! -w "$RO" ] && echo $RO;done
(credit to www.unix.com)
New contributor
Yoric is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |
One way is to make use of the -w
option in bash to check if the file is writable or not.
Go into the directory you want to check your files, then enter:
for RO in $(find . -type f);do [ -r "$RO" ] && [ ! -w "$RO" ] && echo $RO;done
(credit to www.unix.com)
New contributor
Yoric is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
One way is to make use of the -w
option in bash to check if the file is writable or not.
Go into the directory you want to check your files, then enter:
for RO in $(find . -type f);do [ -r "$RO" ] && [ ! -w "$RO" ] && echo $RO;done
(credit to www.unix.com)
New contributor
Yoric is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
edited 2 hours ago
New contributor
Yoric is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
answered 3 hours ago
Yoric
2014
2014
New contributor
Yoric is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
Yoric is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
Yoric is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |
add a comment |
List the files and grep for the read-only pattern:
ls -l | grep '^-r--'
^
symbol indicates start the line.
We are filtering only files here by mentioning ^-
, after that looking only for read permission files by specifying r--
. If you want to filter read & executable permission files, you can use r-x
.
If you want just the filename, you can use below command
ls -l | grep '^-r--' | awk 'NF>1{print $NF}'
Printing the file name using above command works, only if you don't have spaces in file name.
New contributor
BarathVutukuri is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
1
Grepping thels -l
is a smart way to do it, but beware that your files might start with-rw-r--r--
withroot
as the owner, and such files won't be listed, even though they aren't writeable for the user.
– Yoric
3 hours ago
add a comment |
List the files and grep for the read-only pattern:
ls -l | grep '^-r--'
^
symbol indicates start the line.
We are filtering only files here by mentioning ^-
, after that looking only for read permission files by specifying r--
. If you want to filter read & executable permission files, you can use r-x
.
If you want just the filename, you can use below command
ls -l | grep '^-r--' | awk 'NF>1{print $NF}'
Printing the file name using above command works, only if you don't have spaces in file name.
New contributor
BarathVutukuri is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
1
Grepping thels -l
is a smart way to do it, but beware that your files might start with-rw-r--r--
withroot
as the owner, and such files won't be listed, even though they aren't writeable for the user.
– Yoric
3 hours ago
add a comment |
List the files and grep for the read-only pattern:
ls -l | grep '^-r--'
^
symbol indicates start the line.
We are filtering only files here by mentioning ^-
, after that looking only for read permission files by specifying r--
. If you want to filter read & executable permission files, you can use r-x
.
If you want just the filename, you can use below command
ls -l | grep '^-r--' | awk 'NF>1{print $NF}'
Printing the file name using above command works, only if you don't have spaces in file name.
New contributor
BarathVutukuri is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
List the files and grep for the read-only pattern:
ls -l | grep '^-r--'
^
symbol indicates start the line.
We are filtering only files here by mentioning ^-
, after that looking only for read permission files by specifying r--
. If you want to filter read & executable permission files, you can use r-x
.
If you want just the filename, you can use below command
ls -l | grep '^-r--' | awk 'NF>1{print $NF}'
Printing the file name using above command works, only if you don't have spaces in file name.
New contributor
BarathVutukuri is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
edited 1 hour ago
New contributor
BarathVutukuri is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
answered 3 hours ago


BarathVutukuri
1092
1092
New contributor
BarathVutukuri is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
BarathVutukuri is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
BarathVutukuri is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
1
Grepping thels -l
is a smart way to do it, but beware that your files might start with-rw-r--r--
withroot
as the owner, and such files won't be listed, even though they aren't writeable for the user.
– Yoric
3 hours ago
add a comment |
1
Grepping thels -l
is a smart way to do it, but beware that your files might start with-rw-r--r--
withroot
as the owner, and such files won't be listed, even though they aren't writeable for the user.
– Yoric
3 hours ago
1
1
Grepping the
ls -l
is a smart way to do it, but beware that your files might start with -rw-r--r--
with root
as the owner, and such files won't be listed, even though they aren't writeable for the user.– Yoric
3 hours ago
Grepping the
ls -l
is a smart way to do it, but beware that your files might start with -rw-r--r--
with root
as the owner, and such files won't be listed, even though they aren't writeable for the user.– Yoric
3 hours ago
add a comment |
find . -perm -/444 ! -perm /222
searches for all files/folders which are readable (-perm -/444
) but not writable (! -perm /222
).
add a comment |
find . -perm -/444 ! -perm /222
searches for all files/folders which are readable (-perm -/444
) but not writable (! -perm /222
).
add a comment |
find . -perm -/444 ! -perm /222
searches for all files/folders which are readable (-perm -/444
) but not writable (! -perm /222
).
find . -perm -/444 ! -perm /222
searches for all files/folders which are readable (-perm -/444
) but not writable (! -perm /222
).
answered 30 mins ago


nohillside♦
50.8k13109148
50.8k13109148
add a comment |
add a comment |
Steven Evers is a new contributor. Be nice, and check out our Code of Conduct.
Steven Evers is a new contributor. Be nice, and check out our Code of Conduct.
Steven Evers is a new contributor. Be nice, and check out our Code of Conduct.
Steven Evers is a new contributor. Be nice, and check out our Code of Conduct.
Thanks for contributing an answer to Ask Different!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fapple.stackexchange.com%2fquestions%2f347110%2flist-readonly-files%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown