Pruning logs

Posted on Tuesday, 27 May 2008 at 11:20.

I use Adium for my instant messaging. Adium’s log viewer allows me to easily view all messages older than, say, one month, but then selecting them all to delete them takes a very long time, because multiple selection causes Adium to concatenate all these logs and show them. I don’t wanna see their contents, especially if I have more than 1500 of them; Adium just hangs for minutes if I try to delete them this way.

So here’s a way to delete old logs from the command line. Be very careful with these commands — they delete stuff without warning. I will not be responsible for any damage caused! Furthermore, this has been tested on Mac OS X; these commands might behave differently on your machine!

I repeat: I will not be responsible for any damage caused!

Change to the directory with logs:

cd ~/Library/Application Support/Adium 2.0/Users/Default/Logs/

Delete all logs older than one month:

find . -type f -mtime +1m -exec rm {} ;

Delete all (now) empty directories:

find . -type d -empty -depth -exec rmdir {} ;

Leave a comment!

Martijn loves to receive comments! Add yours by filling out the fields below.