I am somewhat of a hoarder when it comes to my chat logs. I routinely find them useful to go back to: “What was that website Bob showed me, again?” “What was the grocery list my wife gave me?” As such, I have around 23,000 logged chats. Now while this may not seem like a problem, I use Dropbox to sync my logs to multiple machines, so that no matter where I am I have access to them. It takes a long time for programs to index 23,000 small files, so I wanted to come up with a way to archive the logs.
Unfortunately Pidgin doesn’t make this easy, as the log files follow a folder naming convention like this:
There’s no way to easily pick out, and keep the folder structure of your log files, so I wrote a Perl script to accomplish the task.
You’ll need Perl installed on your machine. I like to use ActivePerl, which you can grab here.
Extract the package to a directory of your choosing. Next, run the script with the following usage:
perl ArchiveLogs.pl path_to_your_logs_dir year_you_want_to_archive output_directory
For example, on Windows your Pidgin log files are located in the %AppData% directory. Here’s what the command would look like on my machine:
perl ArchiveLogs.pl C:\Users\Brian\AppData\Roaming\.purple\logs 2010 C:\Users\Brian\LogBackups
This will copy all conversations from all of your IM accounts into the LogBackups/YEAR folder. It will then automatically zip those files into an archive.
But what about the old log files? The script has an option to delete your old files. Use this ONLY if you have already archived your logs!
The syntax of the command is the same, but you replace the output directory with the word “DELETE”. For example, if I wanted to delete my old 2010 conversations:
perl ArchiveLogs.pl C:\Users\Brian\AppData\Roaming\.purple\logs 2010 DELETE
That’s all there is to it! However, as usual, USE THIS SCRIPT AT YOUR OWN RISK. I make no guarantees that it’s bug free. 😉
Get the script here: ArchiveLogs.