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 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?

share|improve this question
    
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 Mar 29 '13 at 18:59
add comment

1 Answer

up vote 1 down vote accepted

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>
share|improve this answer
add comment

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.