Shell scripting : Find file with the name 'error_log' and check sizes, remove if over a certain size

Posted by Roy on Stack Overflow See other posts from Stack Overflow or by Roy
Published on 2010-06-06T20:09:52Z Indexed on 2010/06/06 20:12 UTC
Read the original article Hit count: 271

Filed under:
|
|

Hi guys,

I am trying to create a shell script/command that find error_log files created by PHP, check their file sizes and remove them if over a certain size.

I have only gotten as far as printing the files and file sizes with the code below

for i in `locate -r 'error_log$'`;do echo "$i|" `stat -c %s $i`;done

Can anyone help?

Thanks in advance!

© Stack Overflow or respective owner

Related posts about linux

Related posts about shell