Export Picasa 2 Albums to Folders

I recently needed to move some Picasa 2 albums from an old computer to a new one given only the old files and album files. I’d about had it with albums, so I wrote a Python script to convert .pal (Picasa albums) into regular folders.

It chokes on unicode, but dumps errors to a file for you to resolve them – just run this in a directory with your .pil files and it will create subfolders for each album and copy the pictures into them, as well. Use at your own risk.

from xml.dom.minidom import parse
import os.path
import shutil

PICTURESPATH = "C:\\Users\\User\\Documents\\oldcomp\\My Pictures"
ERRORS = open('errors.txt','w')

def populateFolder(albumName):
    global ERRORS
    doc = parse(albumName)
    title = [x for x in doc.getElementsByTagName("property") if x.getAttribute("name")=="name"]
    title = title[0].getAttribute("value")
    files = map(lambda x: x.childNodes[0].nodeValue, doc.getElementsByTagName("filename"))
    translated  = map(lambda x: os.path.expandvars(x).replace("$My Pictures",PICTURESPATH), files)
        ERRORS.write("Cant make directory " + title)
    for f in translated:
            shutil.copy(f, title + "/")
            ERRORS.write("Error in album %s: %s\n" % (title, f))

def main():
    fileList = filter(lambda x: ".pal" in x, os.listdir("."))
    for cFile in fileList:

if __name__=="__main__":

Posted in Code | Leave a comment

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.