Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Organize iChat archive files by sender UNIX
This isn't much of a hint, but what the heck, if someone else had posted it to, it would've saved me five minutes. So here ya go.

I log all of my iChats, and recently noticed that my Documents -> iChats directory was out of control. I figured it would be a good thing to file all the chats into a directory (folder) for each person I chatted with.

Read the rest of the hint for a simple Python script to do just that...

Using your favorite Terminal or GUI text editor, create this script:

import sys
import os, os.path
import re

ichats_dir = os.path.join(os.getenv("HOME"), "Documents/iChats")

patterns = map(re.compile,
        r" on \d{4}-\d{2}-\d{2} at \d{2}\.\d{2}\.chat$",
        r" on \d{4}-\d{2}-\d{2} at \d{2}\.\d{2} #\d+\.chat$",
        r" #\d+\.chat$",

for chat in os.listdir(ichats_dir):
    aim = None
    for pattern in patterns:
            aim = pattern.sub("", chat)
    if aim is None: continue
    aim_dir = os.path.join(ichats_dir, aim)
    if not os.path.isdir(aim_dir): os.mkdir(aim_dir)
    src = os.path.join(ichats_dir, chat)
    dst = os.path.join(ichats_dir, aim_dir, chat)
    print "%s -> %s/%s" % (chat, aim_dir, chat)
    os.rename(src, dst)
Does the job for me.

[robg adds: Simple script for 'jaysoffian,' perhaps! I tested this, and it worked perfectly -- create the script in the Terminal, make it executable (chmod 755 script_name), and then run it (./script_name). On my machine, it organized 1,600+ chat transcripts in about 30 seconds or so. That's the good news.

The bad news is if you, like me, rely on Logorrhea to search and browse your log files, this new organization structure breaks it completely. I'm going to see if the author of Logorrhea can update the app to search sub-folders as well; then I could have the best of both worlds. And hopefully Apple will add username organization to the log file in the future; it just makes more sense.]
  • Currently 2.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (2 votes cast)

Organize iChat archive files by sender | 3 comments | Create New Account
Click here to return to the 'Organize iChat archive files by sender' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Organize iChat archive files by sender
Authored by: aboswell on Sep 10, '04 02:09:12PM
I am a big fan of ChatMaster. It seems to do all that you have suggested and I can access all of my chats in the ChatMaster Interface. Just my 2 cents.

[ Reply to This | # ]
Organize iChat archive files by sender
Authored by: sjk on Sep 10, '04 06:24:19PM

I switched from Logorrhea to ChatMaster because CM can delete unwanted chat files. Its searching is a bit more finicky than Logorrhea's, tho'.

In a similar way that iTunes and iPhoto interfaces can hide the underlying file/folder structure of their data storage I'm fine with iChat hiding its unhierarchical archive folder as long as there's a reasonable way for "virtually" managing/organizing that data. So far ChatMaster's basic interface has worked well enough that I'm satisfied never having to deal with the iChat folder directly from Finder or a Terminal shell.

Moving beyond any default location/structure for storing iChat transcripts I can imagine Spotlight technology in iChat and/or its supporting apps being able to find transcripts (given enough metadata) if users choose to reorganize them differently. In general, that seems a more flexible strategy for certain kinds of applications than if they're imposing specific file/folder structures that users are restricted to using. For example, I hope iTunes and iPhoto become capable of powerfully managing most any user-defined layout of audio and image files, satisfying the requests of folks who want to keep that data organized the way they want it.

[ Reply to This | # ]
Organize iChat archive files by sender
Authored by: dashv on Jul 01, '05 05:41:12PM

at some point the ichat program started to produce chat logs with:


filenames, so.... the script above needs to be 'fixed' to allow for this type of classification simple, inside the 'pattern' pattern matching the first 2 patterns neeed to also match on "zero or 1 'i' characters before 'chat'":

r" on \d{4}-\d{2}-\d{2} at \d{2}\.\d{2}\.i{,1}chat$",
r" on \d{4}-\d{2}-\d{2} at \d{2}\.\d{2} #\d+\.i{,1}chat$",

have fun! (now, if only someone would make a shell program to decode 'ichat' format into 'html' or 'plain text' :(

[ Reply to This | # ]