Score:0

How to remove execute from a folder with subfolders

cn flag

I have a bunch of *.mp3 in a folder with several subfolders. They are currently -rwxrwxrwx 1 I would like these .mp3's to be changed to: -rw-rw-r-- 1 There is nothing in these folders that need to be executable. How might I do this from command line?

hr flag
See [how can I recursively run chmod -x?](https://askubuntu.com/questions/327562/how-can-i-recursively-run-chmod-x)
hr flag
@matigo won't that stomp on the subfolders' `x` bits as well?
mchid avatar
bo flag
Yeah, based on the answer linked by @steeldriver : `find /path/to/folder -name "*.mp3" -exec chmod 664 {} +`
user10489 avatar
in flag
Don't ever run chmod -R 664 because it will break all your directories.
Zanna avatar
kr flag
@matigo directories need x permission, otherwise they don't work (one can't enter them). The `-R` flag to `chmod` is generally of no use because of this.
Score:2
in flag

Try find somefolder -type f -exec chmod o-w,gou-x {} +

Relative permissions are much safer, and you don't want to stomp on directory x permission.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.