Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a server (RHEL 5) with 50+ websites currently running on the same eCommerce software, today I found one of the error log files was over 3GB in size

Is there a way I can find all files over say 20MB on the system and empty them using the file pattern below?

/var/www/vhosts/*/httpdocs/system/logs/error.log

share|improve this question

1 Answer 1

up vote 2 down vote accepted
find /var/www/vhosts -name error.log -size 20M -exec ls -la {} \;

You can substitute any action you want for the "ls -la {}" - the {} is replaced with the filename.

Please note that this will find all files named error.log, not just those in httpdocs/system/logs/ folders.

share|improve this answer
1  
I believe you mean -size +20M. –  Scott Dec 20 '12 at 23:39
    
Thanks a lot! Works perfectly –  Andy Dec 21 '12 at 10:20

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.