Changing permissions on just directories?

paulsjv

Registered
I need to change all the directorys in /blah/blah to have the sticky bit turned on (g+s). What is a command I could do to get this done? I've been messing around with find ./ -type d and that gets me a list of all the directories. Is there a way to pipe that and chmod it the way I want?

Thanks!
 
short answer:
Code:
find . -type d -exec chmod g+s {} \;

long answer:
{} represents the found items. chmod g+s them if that is what you want. And use find . instead of find ./ – the results are passed to -exec ... and the ./ at the beginning of each result might confuse…

Just try it and see the difference in the resulting paths: find ./ -type d vs. find . -type d
 
Back
Top