[Dovecot] OT: Cron Output When Deleting Files

Uldis Pakuls neko at it4u.lv
Wed Oct 17 09:38:56 EEST 2007


tomas at tuxteam.de wrote:
>> On Tue, 16 Oct 2007, Jeff Grossman wrote:
>>
>>     
>>> find ./ -type f -ctime +14 | xargs rm
>>>
>>> I don't know that much about bash scripting.  I would like the output to 
>>> tell me how many files were deleted.  Can anybody share with me how can I 
>>> get that done, or point in the correct direction?
>>>       
>> find ./ -type f -ctime +14 |tee /tmp/find-rm | xargs rm
>> wc -l /tmp/find-rm
>> rm /tmp/find-rm
>>     
>
> Or, having the right version of rm:
>
> find ./ -type f -ctime +14 | xargs rm -v | wc -l
>
>   

Or, print out number of files deleted and their total size in bytes:
find ./ -type f -ctime +14 -printf "%s\n" -exec rm {} \; | awk 
'{s=s+$0}; END{print "Total "NR" files ("s" bytes) removed"}'

> regards
> - -- tomas

> Uldis
>   


More information about the dovecot mailing list