Is there a way to make a file read-only from dired?
This, this, and this are unclear to me.
The manual has lots to say about marking/flagging via dired as well as operating on files, but I can't see anything in operating that discusses changing a file to read-only.
Based on the links above (that I said were unclear to me), I am guessing it has something to do with modes and/or permissions?
For bonus points, is there a way to operate on a directory via dired to make all files within it read-only?
To be clear, I want the files to become read-only and to stay that way until they are changed back to read/write manually.
C
--dired-do-chmod
It works on multiple marked files out of the box. The letterm
marks files. You can select a region and mark everything in one fell swoop. The doc-string describes additional methods to mark --M-x describe-function RET dired-mark RET
"Mark the file at point in the Dired buffer. If the region is active, mark all files in the region. Otherwise, with a prefix arg, mark files on the next ARG lines. If on a subdir headerline, mark all its files except ‘.’ and ‘..’. Use U to remove all marks and u on a subdir to remove the marks in this subdir."M
acts on the marked files. The question already points to the doc about marking. Marking and unmarking are themselves really a different question.)'chmod' is not recognized as an internal...
error when I try it.dired-do-chmod
doesn't run thechmod
program (which would be a problem on Windows, that doesn't have one), but instead uses the Emacs functionset-file-modes
which tries to do the right thing on each OS (cross platform functions like this are one of the things I love the most about using Emacs on Windows: it makes me feel at home, where by "home" I mean Linux!).