i want to set sticky bit for all directories in a directory excluding files. is there any wild card to do this?
#sudo chmod g+s /var/www/<WILD_CARD_FOR_ALL_DIRECTORIES>
Use */
to match only directories.
chmod g+s /var/www/*/
To match all directories and subdirectories use **/*/
(provided you have globstar
enabled in bash):
shopt -s globstar
chmod g+s /var/www/**/*/
you can use find , see below example
find /var/www/ -type d -exec chmod g+s {} \;
-maxdepth
find
argument.
Commented
Jan 4, 2013 at 14:16
This is NOT a wildcard, so I apologize for a non-answer, however...
ls -al |grep ^d | awk '{print$NF}'
will list all directories in the current dir, it's up to you to decide if you want to process .
and ..
or strip them.
echo $(ls -al |grep ^d | awk '{print$NF}')
does makes it behave like a wildcard