Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I need to find all folders on a Linux server with directory name config and put a .htaccess in that directory containing "deny from all".

I'm currently trying to run:

find /home/www/sites/ -type d -name "config" -exec sh -c 'echo "deny from all" > .htaccess' \; 

But it doesn't work.

What have I missed?

share|improve this question
    
Define "doesn't work". –  womble Jul 28 '12 at 2:35
add comment

1 Answer

up vote 1 down vote accepted

Try

find /home/www/sites/ -type d -name "config" -exec sh -c 'echo "deny from all" > {}/.htaccess' \;
share|improve this answer
    
Thanks Womble - worked! –  DmitrySemenov Jul 28 '12 at 2:54
add comment

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.