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
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
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
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
New contributor
edited 2 hours ago
Nimesh Neema
14.6k43871
14.6k43871
New contributor
asked 2 hours ago
Steven Evers
1111
1111
New contributor
New contributor
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
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
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
1 hour ago
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
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
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
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
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
1 hour 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
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
1 hour 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
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
edited 18 mins ago
New contributor
answered 2 hours ago
BarathVutukuri
1112
1112
New contributor
New contributor
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
1 hour ago
add a comment |
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
1 hour 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
1 hour 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
1 hour ago
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
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
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
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
edited 1 hour ago
New contributor
answered 1 hour ago
Yoric
2014
2014
New contributor
New contributor
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