Count and remove old files using Unix find
===

I want to delete files in `$DIR_TO_CLEAN` older than `$DAYS_TO_SAVE` days. Easy:

    find "$DIR_TO_CLEAN" -mtime +$DAYS_TO_SAVE -exec rm {} \;

I suppose we could add a `-type f` or a `-f` flag for `rm`, but I really would like to count the number of files getting deleted.

We could do this naively:

    DELETE_COUNT=`find "$DIR_TO_CLEAN" -mtime +$DAYS_TO_SAVE | wc -l`
    find "$DIR_TO_CLEAN" -mtime +$DAYS_TO_SAVE -exec rm {} \;

But this solution leaves a lot to be desired. Besides the command duplication, this snippet overestimates the count if `rm` failed to delete a file.

I'm decently comfortable with redirection, pipes (including named ones), subshells, `xargs`, `tee`, etc, but I am eager to learn new tricks. I would like a solution that works on both bash and ksh.

**How would you count the number of files deleted by `find`?**