Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I'm trying to combine two things.

I have to set permissions on a number of directories, all of which have "domain-" in their name.

I wanted to "find all directories in the current directory that have the string 'domain-' in their names and change the permissions to 755.

I keep getting syntax errors and am so frustrated that I just need to ask!

thanks

share|improve this question

1 Answer 1

up vote 2 down vote accepted

I would use the find command:

find . -type d -name 'domain-*' -exec chmod 755 {} +
  • . specifies the path to search.
  • -type d makes this only apply to directories.
  • -name ... specifies the name of the directories this should apply to.
  • -exec ... {} + is the command that will be run for each match.
share|improve this answer
    
Thanks Thor, that was exactly what I needed and a nice explanation. –  kelly johnson Feb 14 '13 at 23:45

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.