how to automatically delete ichat transcripts older than X days / weeks

0

I like to store ichat transcripts for a few days so that if I forget something referenced in a chat I can refer back to it. However, after a week or so, I would prefer these transcripts be deleted. Is it possible to automate this process? How?

mheavers

Posted 2013-03-29T18:29:24.527

Reputation: 237

In what format are iChat logs stored on disk? Maybe it's just a simple find program call scheduled using cron or a Launch Agent. What have you tried so far? – Daniel Beck – 2013-03-29T18:59:33.900

Answers

1

I guess there are many ways, but because OSX is UNIX based you can use the good ol' crontab and some bash scripting.

  • Create a script delete_old_transcripts.sh. Make sure it has execute rights.

Code inside the sh file:

#!/bin/bash

$days_old=7
find "~/Documents/iChats" -type f -mtime +$days_old -exec rm -f {} \;
  • Add the script to your user crontab to run each hour (I guess you don't keep your computer open all day, so if it misses one hour it will delete your old files the next hour).

Open crontab configuration:

crontab -e

Add and save:

0 * * * * <path to delete_old_transcripts.sh>

user127350

Posted 2013-03-29T18:29:24.527

Reputation: